I have a model that trained on to predict one of the 14 class,
But when I go for prediction for a single image,
imageData = Image.open(pathImageFile).convert('RGB')
imageData = self.transformSequence(imageData)
imageData = imageData.unsqueeze_(0)
input = torch.autograd.Variable(imageData)
output = self.model(input.cuda())
The output shape is [1,1024,7,7].
Very very weird than Keras predict. how can I know the output label???
the output isn’t a prediction, it’s just a feature map of size
NCHW, you need to add MaxPooling/Linear layers to do classification.
After forward passing it should be outputting the class prediction, as it contains,
features = self.features(x)
out = F.relu(features, inplace=True)
out = F.adaptive_avg_pool2d(out, (1, 1)).view(features.size(0), -1)
out = self.classifier(out)
But it returning the same shape.