Hi I just started with deep learning and based on the lecture 1 and 2 I created a classification model with custom images but I am stuck with a few things and I am unable to wrap my head around it.
I have uploaded all my images to a folder in jupyter and reading lablels from csv below is my code:
np.random.seed(42)
data = ImageDataBunch.from_csv(path, folder=".", valid_pct=0.2, csv_labels='labels.csv',
ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats)
#need to understand differnce between create_cnn and cnn_learner
learn = create_cnn(data, models.resnet34, metrics=accuracy)
defaults.device = torch.device('cuda')
learn.fit_one_cycle(4)
learn.unfreeze()
learn.lr_find()
learn.recorder.plot()
learn.fit_one_cycle(4, max_lr=slice(3e-5, 3e-4))
learn.save('my-first-model')
#now here i try to do an export()(but going through the forums I understand that export is only for inference but still having a tough time wrapping my head around it
learn.export()
also I get the below error
AttributeError: module 'fastai.vision.learner' has no attribute 'export'
main issue is how do I load my saved model and how do I predict my classes names (I have 4 classes), Lastly if I export the model into my local how can I run it to predict classes.
I tried the ImageDataBunch.from_single_classes its now load_empty as per documentation but all I get is
‘ImageDataBunch’ has no attribute ‘load_empty’
so in conclusion I have a saved model I am not sure how to load the model and how to predict my class names for a given image
any suggestions much appreciated.
ps: I believe I am posting in the appropriate forum if not please excuse me and point me to the right place.
Thanks,
bhanu