Calculating the Accuracy for test set

I did a similar thing i a slightly different way to verify my results: create a new databunch with only train images and prevent it from shuffling and clipping:

il = ImageList.from_folder(path=path)
ils = il.split_none()
ll = ils.label_from_folder()
ll.transform(tfms=tfms,size=size)
new_data = ll.databunch(bs=bs);
new_data.train_dl = new_data.train_dl.new(shuffle=False, drop_last=False) # Important: prevent shuffle!
new_data.normalize(stats)

Then you substitute the “data” on your learner and compute interpretation on Train:

learn.data = new_data
interp = ClassificationInterpretation.from_learner(learn,ds_type=DatasetType.Train)

NOTE: Sugger suggested how to prevent your Train set to shuffle here:

3 Likes