Hello,
I am trying to using Fastai’s V1 predict on a single new image that comes in. This works great on Fastai V0.7. I used val_tfms the following code, where SMILES is the string name for a png file. This is for V0.7:
fn = f'{PATH1}test_images/%s.png' %SMILES
trn_tfms, val_tfms = tfms_from_model(arch,sz)
ds = FilesIndexArrayDataset([fn], np.array([0]), val_tfms, PATH1)
dl = DataLoader(ds)
log_preds = learn.predict_dl(dl)
preds = np.argmax(log_preds, axis=1) # from log probabilities to 0 or 1 - get the max on either side
probs = np.exp(log_preds[:,1])
image = Image.open(fn)
image.show()
However for V1, I cannot do this. I would like to know if this is possible. Again, I want to use it on a new image that comes in, not on an image in the dataset. Here is where I am right now. Using learn.predict, I am trying to use the following image:
I get this error when I run learn.predict(image) - PNGImageFile has no attribute ‘clone’. This tells me I need to change the image to a fastai image. I don’t know how to do that. Is this possible? Please let me know! Thanks!
