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

前端 未结 3 704
礼貌的吻别
礼貌的吻别 2020-12-29 10:36

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 C

3条回答
  •  感动是毒
    2020-12-29 11:26

    As mentioned by @yl_low here

    Step 1:

    !apt-get install -y -qq software-properties-common python-software-properties module-init-tools
    !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
    !apt-get update -qq 2>&1 > /dev/null
    !apt-get -y install -qq google-drive-ocamlfuse fuse
    

    Step 2:

    from google.colab import auth
    auth.authenticate_user()
    

    Step 3:

    from oauth2client.client import GoogleCredentials
    creds = GoogleCredentials.get_application_default()
    import getpass
    !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
    vcode = getpass.getpass()
    !echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}
    

    Both Step 2 and 3 will require to fill in the verification code provided by the URLs

    Step 4:

    !mkdir -p drive
    !google-drive-ocamlfuse drive
    

    Step 5:

    print('Files in Drive:')
    !ls drive/
    

提交回复
热议问题