Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google colaboratory 如何将本地驱动器中的图像读取到Google Colab中_Google Colaboratory - Fatal编程技术网

Google colaboratory 如何将本地驱动器中的图像读取到Google Colab中

Google colaboratory 如何将本地驱动器中的图像读取到Google Colab中,google-colaboratory,Google Colaboratory,我想在googlecolab中运行具有强大GPU支持的深度学习模型。我对科拉布很陌生。最初我认为我可以使用os.path.join和PIL.Image.open来上传图像,就像我在Spyder环境中所做的那样。但是Colab给出了一个FileNotFoundError FileNotFoundError:[Errno 2]没有这样的文件或目录(图像确实存在于本地目录中)。似乎我没有正确的上传 您可以直接上传到colab或将图像上传到google drive文件夹。然后将该文件夹装入GoogleC

我想在
googlecolab
中运行具有强大GPU支持的深度学习模型。我对科拉布很陌生。最初我认为我可以使用
os.path.join
PIL.Image.open来上传图像,就像我在
Spyder
环境中所做的那样。但是
Colab
给出了一个
FileNotFoundError FileNotFoundError:[Errno 2]没有这样的文件或目录
(图像确实存在于本地目录中)。似乎我没有正确的上传

您可以直接上传到colab或将图像上传到google drive文件夹。然后将该文件夹装入GoogleColab以使用它。左边有一个箭头,打开一个侧栏,其中包含可搜索的代码片段。在这里,您可以搜索驱动器以获取与google驱动器相关的代码片段

这个笔记本里有一些例子,

下面的命令列出名为DeepLearning的文件夹的内容

!ls -la "/content/gdrive/My Drive/DeepLearning"
将驱动器DeepLearning文件夹的内容复制到DeepLearning文件夹中的虚拟机

!cp /content/gdrive/My\ Drive/DeepLearning ./DeepLearning
!cp ./DeepLearning /content/gdrive/My\ Drive/DeepLearning
将虚拟机DeepLearning文件夹的内容复制到google drive DeepLearning文件夹

!cp /content/gdrive/My\ Drive/DeepLearning ./DeepLearning
!cp ./DeepLearning /content/gdrive/My\ Drive/DeepLearning
您可以运行
%cd DeepLearning
将目录更改为DeepLearning文件夹

GPU支持可以通过
Runtime>Change Runtime Type>Hardware Accelerator>GPU
来启用