I want to train a deep learning model on a dataset containing around 3000 images. Since the dataset is huge, I want to use Google colab since it's GPU supported. How do I upload this full image folder into my notebook and use it?

Method 1 :

1. zip the file
2. Upload the zipped file, there is an Upload button under the Files Section.
3. Unzip it using the command on colab : !unzip level_1_test.zip

Method 2 :

3. Unzip it using the command on colab : !unzip level_1_test.zip
• Thanks a lot! Subjectively - method 2 is faster. Also the easier way to download a file from drive to colab is described here in the top answer stackoverflow.com/questions/48735600/… Jun 8, 2020 at 18:31

The best bet would be to upload the images as a zip file to your Google drive and then access it through Google Colab (GC)

1. Zip the image folder

from google.colab import drive
drive.mount('/content/drive')


5. Unzip the file from GC

!unzip -uq "/content/drive/My Drive/PATH_TO_ZIP" -d "/content/drive/My Drive/PATH_TO_OUTPUT"

6. The files are now ready to use

• it is very slow method May 7, 2021 at 13:30

! wget <Link>

Else upload then to your drive and then just use the following

from google.colab import files

##dictionary is keyed by the file name, the value is the data which was

print('User uploaded file "{name}" with length {length} bytes'.format(


You can upload stuff to Google Drive and then download it from there on Colab. I've written some utils for that - see this notebook.

As to how upload files to Google Drive, Media's suggestion is useful - upload zipped image folder.

On Colab simply use:

!gdown --id file_id


https://drive.google.com/file/d/zz2Xs5Vriz6aF3V-Z22112yAj91c222fI1F/view?usp=sharing

!gdown --id zz2Xs5Vriz6aF3V-Z22112yAj91c222fI1F