How do we use our model against a specific image?

Yah I was just seeing that. Revised my code using fast.ai transforoms and helpers as such:

trn_tfms, val_tfrms = tfms_from_model(arch, sz)
im = val_tfrms(Image.open(f'{PATH}/valid/in-n-out/2.jpg'))

log_probs = to_np(learn.models.model(V(T(im[None]).cuda())))
preds = np.argmax(log_probs, axis=1)

print(preds)
6 Likes