Trainset.classes returns a list with '.ipynb_checkpoints'

After creating my trainset as below
trainset = torchvision.datasets.ImageFolder('data/train/', transform=transform)
running trainset.classes returns this list ['.ipynb_checkpoints', '0', '1'].

Later when I try to train my model I get the error
IndexError: Target 2 is out of bounds
which I believe is due to my classes being length 3 instead of 2.

How do I fix this safely?

1 Like

Was able to fix the issue by deleting the .ipynb_checkpoints folder using shutil.rmtree('data/train/.ipynb_checkpoints')

1 Like