Is it possible or does it make sense to use BCEWithLogitsLossFlat in the lesson1-pets notebook to build a model which can make “reasonable” predictions on images which don’t contain one of the training classes. That is a model which when presented with a new breed of dog/cat should generate low “probabilities” for all classes in the way Jeremy described in Lesson 9.
One way would be to copy the definition of parent_label(), rename it (to for example parent_labeler) with the changes suggested by sgugger ( [Path(o).parent.name] instead of Path(o).parent.name)
def parent_labeler(o, **kwargs):
"Label `item` with the parent folder name."
return [Path(o).parent.name]