We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expected 4-dimensional input for 4-dimensional weight 64 3 7 7, but got 3-dimensional input of size [3, 448, 448] instead 增加了下面一行代码 ,出现了更多的问题。感谢感谢!!! def predict_gpu(model,image_name,root_path=''):
result = [] image = cv2.imread(root_path+image_name) h,w,_ = image.shape img = cv2.resize(image,(448,448)) img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB) mean = (123,117,104)#RGB img = img - np.array(mean,dtype=np.float32) transform = transforms.Compose([transforms.ToTensor(),]) img = transform(img) img = img.cuda() **img = torch.unsqueeze(img, dim=0)** pred = model(img) #1x7x7x30 pred = pred.cpu() boxes,cls_indexs,probs = decoder(pred) for i,box in enumerate(boxes): x1 = int(box[0]*w) x2 = int(box[2]*w) y1 = int(box[1]*h) y2 = int(box[3]*h) cls_index = cls_indexs[i] cls_index = int(cls_index) # convert LongTensor to int prob = probs[i] prob = float(prob) result.append([(x1,y1),(x2,y2),VOC_CLASSES[cls_index],image_name,prob]) return result
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Expected 4-dimensional input for 4-dimensional weight 64 3 7 7, but got 3-dimensional input of size [3, 448, 448] instead
增加了下面一行代码 ,出现了更多的问题。感谢感谢!!!
def predict_gpu(model,image_name,root_path=''):
The text was updated successfully, but these errors were encountered: