'CNN In Google Colab
I have a CNN project, I want to upload images dataset from my local files, How can I do that? and is there an esier way to import dataset to google colab (e.g. Kaggle or from tensor flowdo)? and how I can do this? Then is there a good document or reference can help me to do that project because I'm a beginner. Thanks in advance.
Solution 1:[1]
Following are the ways you can use to import data set/files in Google Colab:
- Upload data set from local
from google.colab import files
uploadToUpload = files.upload()
This will add a browse button which can be used to select files from local. files.upload()
returns a dictionary of the files which are uploaded..
Suppose one selects a data set (data_set.csv) from local, you can access it in following way:
data = pd.read_csv(io.StringIO(uploadToUpload['data_set.csv'].decode('utf-8')))
- Uploading data set from Google Drive
from google.colab import drive
drive.mount('/content/gdrive')
This will mount Google Drive to Files tab in the left panel. To go to your drive’s main directory (Google Drive home page, first page visible when one login to drive) cd into “/content/gdrive/My Drive/”
Suppose one has a data set (data_test.csv) in folder named DataSet, you can access in following way:
data = pd.read_csv('/content/gdrive/My Drive/DataSet/data_test.csv')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Manjur Ansari |