Based on the demo code it looks like one demo is using a pretrained torchvision.models.resnet18.
This model outputs logits for each class, such that the highest logit would correspond to the predicted class. You could apply a softmax, which is not necessary to get the prediction, but will give you probabilities, which might be easier to interpret.
If I’m right in point 1, you should see positive and negative numbers as the logit output.
For 3, I already have a trained model and serialized it to be used in the mobile app, so by adding a softmax layer to my model, does it mean I have to re-train it since the original model doesn’t have a softmax layer. Are there anyway, that we can calculate percentage based on the result of the serialized model?
No, you don’t need to retrain the model if you just want to get the probabilities with a softmax layer.
I think the easiest way could be to pass your current model and the nn.Softmax layer to a new custom model or an nn.Sequential container and use this new combined model in your app.
Alternatively, you could compute the softmax on the mobile, as the formula is quite straightforward.