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.
I have tried using
path = untar_data(URLs.PETS) path_img = path/'images' fnames = get_image_files(path_img) pat = r'\\([^\\]+)_\d+.jpg$' label_func = RegexLabeller(pat) seed = 2 valid_pct=0.2 item_tfms=RandomResizedCrop(460, min_scale=0.75) b =64 num_workers=0 batch_tfms=[*aug_transforms(size=224, max_warp=0), Normalize(*imagenet_stats)] dblock = DataBlock(blocks=(ImageBlock, MultiCategoryBlock()), splitter=RandomSplitter(valid_pct, seed=seed), get_y=label_func) dbunch = DataBunch.from_dblock(dblock, fnames, path=path, item_tfms=item_tfms,b=b,num_workers=num_workers, batch_tfms=batch_tfms)
but the resulting labels
are generated from the first letter of each class.
Do I have to use a dataframe?