Search code examples
pythonneural-networkgoogle-colaboratory

load image dataset (folder or zip) located in Google Drive to Google Colab?


I have a dataset of images on my Google Drive. I have this dataset both in a compressed .zip version and an uncompressed folder.

I want to train a CNN using Google Colab. How can I tell Colab where the images in my Google Drive are?

  1. official tutorial does not help me as it only shows how to upload single files, not a folder with 10000 images as in my case.

  2. Then I found this answer, but the solution is not finished, or at least I did not understand how to go on from unzipping. Unfortunately I am unable to comment this answer as I don't have enough "stackoverflow points"

  3. I also found this thread, but here all the answer use other tools, such as Github or dropbox

I hope someone could explain me what I need to do or tell me where to find help.

Edit1:

I have found yet another thread asking the same question as mine: Sadly, of the 3 answers, two refer to Kaggle, which I don't know and don't use. The third answer provides two links. The first link refers to the 3rd thread I linked, and the second link only explains how to upload single files manually.


Solution

  • To update the answer. You can right now do it from Google Colab

    # Load the Drive helper and mount
    from google.colab import drive
    
    # This will prompt for authorization.
    drive.mount('/content/drive')
    
    !ls "/content/drive/My Drive"
    

    Google Documentation