有什么方法可以将本地数据集文件夹直接从Google驱动器直接加载到Google Colab? [英] is there any way to load local data set folder directly from google drive to google colab?

查看:64
本文介绍了有什么方法可以将本地数据集文件夹直接从Google驱动器直接加载到Google Colab?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 点击上传到会话存储

  1. 从您的计算机中选择要上传的文件

  1. 它将提示一些信息,表明该文件仅可用于当前会话,单击确定.

  2. 文件将上传到目录中.单击它(鼠标左键和鼠标右键都相同).

然后;

  1. 复制路径和在pd.read_csv()函数中使用它.

注意:会话终止后,文件将从colab会话中丢失.要再次使用它,您需要再次上传.很多时候,我们更喜欢将所有数据保存在GitHub存储库或google drive文件夹中.

see the image carefullyi couldn't load custom data folder from google drive to google colab.though i mounted google drive.like instead of MNIST data set i want to load my own image data set folder.i have tried pydrive wrapper.but i need simple solution. suppose i have dataset of images inside google drive.how to load it to google colab?

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

then

with open('/content/gdrive/My Drive/foo.txt', 'w') as f:
   f.write('Hello Google Drive!')
   !cat /content/gdrive/My\ Drive/foo.txt

here insted of foo.txt i have an image folder called Dog inside ml-data folder.but i can't load it.how to load it in google colab directly from google drive as it is in my local hard drive.

解决方案

To load data directly from the local machine, you need to follow these steps:

  1. Go to files [left side menu]

  1. Click on upload to session storage

  1. Select file(s) from your machine to upload

  1. It will prompt something indicating that file(s) will be available for the current session only, click ok.

  2. The file(s) will be uploaded in the directory. Click on it (left and right-click both work the same).

And then;

  1. Copy path & use it inside pd.read_csv() function.

Note: After the session is terminated, files will be lost from colab session. To use it again, you'll need to upload it again. Many times, we prefer to it have all our data in a GitHub repository or in a google drive folder to fetch from there.

这篇关于有什么方法可以将本地数据集文件夹直接从Google驱动器直接加载到Google Colab?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆