I have successfully created a small part of the code and modified existing codes which can do the prediction on an input image. Basically I have changed input sample in the networks.py -- forward function from:
_vgg16_output = self.vgg16extractor(sample['image'])
to
_vgg16_output = self.vgg16_extractor(torch.from_numpy(sample.astype(np.float32)).reshape(1, 3, image_w, imageh).cuda())
where sample in this case is the numpy array of input image.
However, during the concatenation of landmarks map (lm_merge_map) from attention branch and convolution features (conv_feature) from conv43 layer I am getting this error:
RuntimeError: Sizes of tensors must match except in dimension 2. Got 60 and 28 (The offending index is 0)_
Hello,
I have successfully created a small part of the code and modified existing codes which can do the prediction on an input image. Basically I have changed input sample in the networks.py -- forward function from: _vgg16_output = self.vgg16extractor(sample['image']) to _vgg16_output = self.vgg16_extractor(torch.from_numpy(sample.astype(np.float32)).reshape(1, 3, image_w, imageh).cuda()) where sample in this case is the numpy array of input image.
However, during the concatenation of landmarks map (lm_merge_map) from attention branch and convolution features (conv_feature) from conv43 layer I am getting this error: RuntimeError: Sizes of tensors must match except in dimension 2. Got 60 and 28 (The offending index is 0)_
where the dimensions of both tensors are:
_conv_feature: torch.Size([1, 512, 60, 77]), lm_mergemap: torch.Size([1, 1, 28, 28])
and dimensions of input image is:
_image_h: 622, image_w: 486 , channelnum: 3
I am attaching the screenshot as well. Any help will be greatly appreciated. Thank you so much in advance.