Reputation: 236
I am using pretrained vgg-19 from torch.vision module I have the pre-processing of image data like below:
normalize = transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
preprocess = transforms.Compose([
transforms.Scale(224),
transforms.ToTensor(),
normalize
])
The problem is if I pass an image like a tennis ball through the network and save all the 1000 class score from the final FC layer and pass the same image again after some time, the final FC layer i.e the class score is slightly changed. Although the image category detected by the network is correct. (its a tennis ball)
Is it normal to have the slightly different class score for the same image? I mean, does this suppose to happen? Or for the correctly implemented pre-trained model, the network should give you the exact same class score every time for the same image.
Upvotes: 1
Views: 922
Reputation: 18693
Possible reasons why the class score could be different:
model.train()
and didn't activate the evaluation mode using model.eval()
and your model contains some stochastic parts like dropout or adding noise to input. Then those stochastic parts will still be active.Upvotes: 2