Not a Directory error in CIFAR10 exercise

I ran into this as well. In my case, it was because the python script created a new folder called ‘cifar’. My files were located in a folder called ‘cifar10’. The script created a bunch of empty folders, and I redirected my notebook to the new ‘cifar’ folder without realizing all the subfolders were empty. The fix was simple: I just changed the lines defining the path in the python script to correctly point to the train and test folders in ‘cifar10’ rather than ‘cifar’.

using perl’s superhandy for file/dir mangling util https://stackoverflow.org/wiki/Rename.pl it’s just a one-liner:

find -name "*png" -execdir rename.pl 's|^./(\d+)_(.*?).png|mkdir($2) unless -d $2;"$2/$1.png"|e' {} \;

assuming you first run:

wget http://pjreddie.com/media/files/cifar.tgz
tar -xzf cifar.tgz
mv cifar cifar10
cd cifar10

and made the script executable and in the execution path:

  1. copy-n-paste the code from https://stackoverflow.org/wiki/Rename.pl into a file: rename.pl,
  2. make it executable:
    chmod a+x rename.pl
  3. put it somewhere in your shell’s execution path, e.g./usr/bin
    sudo mv rename.pl /usr/bin/

I use this script very often. It uses the same regex as python, expect in a much simpler form s/from/to/.

Thank you! If you change “cifar” to “cifar10” it works perfectly