Extend training after loading the model in fast-ai which was saved locally?

I want to further train my save model in fast-ai (which is a classifier for healthy and unhealthy potato leaves), I trained and model using (resenet34) in fast-ai, then saved using lerner.save(“classification_fastai_model_1”) . It was successfully saved and now I want to train more using new images for the same kind of classification.

from fastai import *
from fastai.vision import *
path = "PlantVillage2" 

There are 2 subfolders in this folder one is for healthy and other is for unhealthy

data = ImageDataBunch.from_folder(path,
data.show_batch(row=3, figsize=(8,9))
learner = cnn_learner(data, models.resnet34, metrics=[accuracy, error_rate])

I am getting this error now; I have already converted all the images into RGB using Photoshop Batch processing.

RuntimeError: The size of tensor a (2) must match the size of tensor b (3) at non-singleton dimension 0

Any help from you will be appreciated, Thanks.

You should tell us which of the line threw an error and copy the whole stack trace here, as it would be easier to help you with this.

1 Like