In working through the lesson 1 stuff I wanted to try using my trained dataset on a separate single test image.
I found several topics on how to do that here, but am getting an error I didnt see mentioned. Here is the code im using:
trn_tfms, val_tfms = tfms_from_model(arch,sz) # get transformations
im = (np.array(Image.open(f’{PATH}testimage1.png’)))
print(im.shape)
im = val_tfms(im)
learn.precompute=False # We’ll pass in a raw image, not activations
preds = learn.predict_array(im[None])
np.argmax(preds) # preds are log probabilities of classes
Note that I broke that up a bit in an effort to understand the error. The same error occurs when condensed into the versions posted on this forum.
Here is the error that occurs on the val_tfms(im) step: