NotADirectoryError: [Errno 20] Not a directory when trying to load in Zip file on Google Colab
I'm trying to experiment on Google Colab with CNNs and GANs using the CelebA dataset. I'm trying to load in the data in PyTorch using ImageFolder like so:
# Loading in data

dataroot = &quot;/content/drive/MyDrive/Colab_Notebooks/celeba/img_align_celeba.zip&quot;


dataset = dset.ImageFolder(root = dataroot,
                           transform = transforms.Compose([
                                       transforms.Resize(image_size),
                                       transforms.CenterCrop(image_size),
                                       transforms.ToTensor(),
                                       transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),                    
                           ]))

Bear in mind, I've fully mounted my drive and have the celeba.zip file on my G-Drive. However, when trying to execute the above, I get the following error:
---------------------------------------------------------------------------
NotADirectoryError                        Traceback (most recent call last)
&lt;ipython-input-13-ebc6bb8ab4bd&gt; in &lt;module&gt;()
     10                                        transforms.CenterCrop(image_size),
     11                                        transforms.ToTensor(),
---&gt; 12                                        transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
     13                            ]))

3 frames
/usr/local/lib/python3.7/dist-packages/torchvision/datasets/folder.py in find_classes(directory)
     38     See :class:`DatasetFolder` for details.
     39     &quot;&quot;&quot;
---&gt; 40     classes = sorted(entry.name for entry in os.scandir(directory) if entry.is_dir())
     41     if not classes:
     42         raise FileNotFoundError(f&quot;Couldn't find any class folder in {directory}.&quot;)

NotADirectoryError: [Errno 20] Not a directory: '/content/drive/MyDrive/Colab_Notebooks/celeba/img_align_celeba.zip'

Unless I'm missing something, my dataroot variable is the correct directory as it's the correct path to the zip containing the images. I've attempted to unzip the files by doing:
!cp &quot;{dataroot}&quot; .
!yes|unzip -q img_align_celeba.zip

but I still get the same error - am I missing something?

Zip files aren't folders. Try unzipping first although you'll need to cd to the folder first - so something like this.
!cd /content/drive/MyDrive/Colab_Notebooks/celeba 

Then unzip
!yes|unzip -q img_align_celeba.zip -d img_align_celeba

Then this should work.
dataroot = '/content/drive/MyDrive/Colab_Notebooks/celeba/img_align_celeba'
dataset = ImageFolder(root = dataroot, transform=transform)

