PyTorch resnet bad tensor dimensions
I'm trying to setup a face detection/recognition pipeline using Pytorch.
I load the image using opencv
image = cv2.imread('...')
I load the mtcnn
face detection and resnet
face recognition models
self.mtcnn = MTCNN(keep_all=True, device=self.device)
self.resnet = InceptionResnetV1(pretrained='vggface2').eval()
Then I run detection and recognition
cropped = detector.mtcnn(image)
detector.resnet(cropped.unsqueeze(0))
And get this error
Expected 4-dimensional input for 4-dimensional weight [32, 3, 3, 3], but got 5-dimensional input of size [1, 1, 3, 160, 160] instead
I also tried resizing the image to 512x512 and passing image_size=512
to the MTCNN constructor but I get a similar error.
Topic inceptionresnetv2 pytorch
Category Data Science