Untill version 1.0.39 models for inference needed to export 2 files:
1 file with data.export()
1 file with model.save()
Then during inference, the list of the class names were recover like this:
empty_data = ImageDataBunch.load_empty()
empty_data.classes --> gives the list of all the classes used during training
Since fastai version 1.0.40 we can export model directly with:
This is great because we can do inference using only the “export.pkl” file.
The problem is that I can’t recover the list of class names.
empty_data = ImageDataBunch.load_empty(“export.pkl”) but I always have an error:
When I create the model like this:
model = load_learner(“export.pkl”)
I’m able to make prediction one image at a time with model.predict(img)
It gives the class Name so it means that the names of all the classes are embedded in the file “export.pkl”
How is it possible to get the list of the class names ?
Thanks for your answers and best regards