I have dataset from https://www.kaggle.com/puneet6060/intel-image-classification that I have in my Google drive. These folders are zipped.
Help needed with How do I access individual zip folders(seg_train.zip,seg_test.zip,seg_pred.zip) from the main folder? Then, after accessing the zip, say seg_train.zip, how to access folders (building,glaciers) from that?
I tried below code:
!pip install PyDriveimport os
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
download = drive.CreateFile({'id': '1d7-jWu8P1q3cNfcRaqSE8bybUrdl9qyW'})
download.GetContentFile('data.zip')
!unzip data.zip
ID of the main folder being
1d7-jWu8P1q3cNfcRaqSE8bybUrdl9qyW
I am getting below error:
FileNotDownloadableError Traceback (most recent call last)
<ipython-input-9-db7681c14c0b> in <module>()
----> 1 download.GetContentFile('data.zip')
2 get_ipython().system('unzip data.zip')
2 frames
/usr/local/lib/python3.6/dist-packages/pydrive/files.py in FetchContent(self, mimetype, remove_bom)
263 else:
264 raise FileNotDownloadableError(
--> 265 'No downloadLink/exportLinks for mimetype found in metadata')
266
267 if mimetype == 'text/plain' and remove_bom:
FileNotDownloadableError: No downloadLink/exportLinks for mimetype found in metadata
Skip PyDrive and mount your Google Drive directly using this snippet:
from google.colab import drive
drive.mount('/content/drive')
Then, you can access directories in Drive just as though they were normal files on the backend VM.