Deep Learning Brasília - Lição 1

Get the prediction on a specific image after training

Links :

Code (fn is the file name of the image) :

trn_tfms,val_tfms = tfms_from_model(arch, sz, aug_tfms=transforms_side_on, max_zoom=1.1)
img = open_image(PATH+fn)
im = val_tfms(img)
pred = learn.predict_array(im[None])
result = np.argmax(preds, axis=0)
print(f'The class is : {data.classes[result[0]]}')
plt.imshow(img)
1 Like