How to make ImageFolder ignore .ipynb_checkpoints

Hello, I am having a problem of using ImageFolder in Jupyter Notebook. Jupyter Notebook automatically creates .ipynb_checkpoints file, and ImageFolder recognizes it as one of the classes. I can remove it, but everytime I run the code it’s there again. Anyway for ImageFolder to completely ignore it?

2 Likes

I couldn’t reproduce this issue. Also, ImageFolder should only detect the allowed file extensions.
Could you post your folder structure so that I could have a look?

I’m having this same issue. My folder structure is simply images_dir -> many images with a .jpeg extension. Whenever I try to load this dir in a notebook with datasets.ImageFolder, the notebook creates a .ipynbcheckpoints folder and starts placing loaded images in there.

Edit: I think I see the issue. The ImageFolder loader is expecting images to be separated into subdirectories. I have no need of a subdirectory, but I guess I need to make one anyway to avoid this.

As you explained, ImageFolder uses a subdirectory for each class.
If you don’t need it, you could write your custom Dataset and load the data using your own logic.