When I ran
pred_class,pred_idx,outputs = learn.predict(img)
I got the result below intead of the class name
<fastai.core.Category at 0x2d4b2879240>
The fastai version that I used is 1.0.46.
The platform is Anaconda Prompt in Windows10.
How is your data set up?
In the mnist example the data is split into folders called ‘3’ and ‘7’ and we use ImageDataBunch.from_folder.
What are you using for bunching your data?
Hi @mcclomitz, thanks for your reply. I was working on the bear example in lesson2-download.ipynb. I was using the folder setup for bunching the data.
I’m getting the same thing on my local windows machine.
I also then tried it in GCP, which has default Debian 9.6, with the latest fastai version and just ran a simple mnist like in the tutorial and got the same:
(<fastai.core.Category at 0x7f05502ce668>,
The classes do still show up in the Learner object:
All above is running with fastai v.1.0.46. I’m not sure at which version the problem started though…
Turns out that you can still get the class name if you just save it and then print it out explicitly:
pred_class, pred_idx, outputs = learn.predict(img)
“Basic class for single classification labels.”
def init(self,data,obj): self.data,self.obj = data,obj
def int(self): return int(self.data)
def str(self): return str(self.obj)
Category did overwrite str(self) implemented. Can’t figure out why print() needs to be called explicitly.
Thank you! it’s embarrassing how long I’ve been struggling w/this one step!!