I am trying to get feature vectors of images from models pre-trained on imagenet. I am using learn.get_preds()
since it does the scoring in batches which is much quicker than scoring individually.
The problem I am having is I can’t seem to confirm that rows in my predictions tensor (number of images x 1000 (output size of pre-trained models)). I am trying to compare the model output of the first input in my dataset with the output of the get_preds
, but the predictions are different. I tried to check if it was because of fastai automatically normalizing on get_preds
, but may have not checked that correctly. Any help would be appreciated.
Below is code I am using and a screen shot of different vector outputs.
# fastai 1.0.52 (SageMaker notebook)
data = (
ImageList
.from_folder(path/'product-images/square-224')
.split_none()
.label_empty()
.databunch(bs=16)
.normalize(imagenet_stats))
data_test = (
ImageList
.from_folder(path/'product-images/square-224'))
learn = Learner(data, m)
preds = learn.get_preds('train')