Chapter 2 - Issue with show_batch()

Hi all,

I am on the Chapter 2 - Production of the fastbook, and noticed some weird behaviour with the show_batch() function.

In the following code, I keep getting the images with the wrong labels:

bears = DataBlock(
    blocks=(ImageBlock, CategoryBlock), 
    splitter=RandomSplitter(valid_pct=0.2, seed=42),

dls = bears.dataloaders(path, num_workers=0)

I double checked and the images are in the correct folders (i.e. the teddy, named grizzly are actually in the teddy folder).

Also, whenever I try the batch transformations, I get an IndexError when running the show_batch() afterwards. I guess this might have to do with the fact that I’m in a windows environment (I had to set num_workers=0 in the dls to make the training work).

My lib versions:
fastai 2.1.10
fastbook 0.0.16
fastcore 1.3.19
torch 1.8.1
torchaudio 0.8.1
torchvision 0.9.1

CUDA 11.3

Any ideas of what might be wrong?


If you are executing the notebook line by line and are sure the misclassified images are in the right folders, maybe update fastai?