简体   繁体   English

在 google colab 中访问目录

[英]accessing of Directory in google colab

good evening guys, i am using google colab, because it supports GPU and TPU and without it, i can't run many Deep Learning codes on my computer, i have installed already google colab ,just question is following: let us suppose my working directory is this https://drive.google.com/drive/u/0/folders/1EvNegzEhMp0NtKXY_Hm9jsBpA4Amwcs大家晚上好,我正在使用 google colab,因为它支持 GPU 和 TPU,没有它,我无法在我的计算机上运行许多深度学习代码,我已经安装了 google colab,只是问题如下:让我们假设我的工作目录是这个https://drive.google.com/drive/u/0/folders/1EvNegzEhMp0NtKXY_Hm9jsBpA4Amwcs

here i can upload images, csv files and so on, i have searched a lot of material about this one and i found following在这里我可以上传图片、csv 文件等等,我搜索了很多关于这个的材料,我找到了以下内容

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

i have run this code and follow instructions and finally i got : Mounted at /content/drive我已运行此代码并按照说明进行操作,最后我得到了:安装在 /content/drive

after that i have uploaded simple file to this directory and run following code之后,我已将简单文件上传到此目录并运行以下代码

from google.colab import drive
drive.mount('/content/drive')
import matplotlib.pyplot as plt
import numpy as np
import cv2
import skimage
from skimage import data
from skimage import io
Image =cv2.imread('palm.jpg')
io.imshow(Image)

AttributeError: 'NoneType' object has no attribute 'dtype' , i have searched documentation about this error and found, that my Image might be [] , so what is reason of an error? AttributeError: 'NoneType' object has no attribute 'dtype' ,我搜索了有关此错误的文档,发现我的 Image 可能是 [] ,那么错误的原因是什么? please help me请帮我

Mention full path of image in code '/content/drive/MyDrive/Machine Learning/OpenCV/palm.jpg'在代码'/content/drive/MyDrive/Machine Learning/OpenCV/palm.jpg' 中提及图像的完整路径

from google.colab import drive
drive.mount('/content/drive')
import matplotlib.pyplot as plt
import numpy as np
import cv2
import skimage
from skimage import data
from skimage import io
Image =cv2.imread('/content/drive/MyDrive/Machine Learning/OpenCV/palm.jpg')
io.imshow(Image)

When you mount your drive, look for the "drive" folder in your contents.安装驱动器时,请在内容中查找“驱动器”文件夹。 You have to find the path to the image from that folder.您必须从该文件夹中找到图像的路径。 It may be something like img_path = '/content/drive/My Drive/sample.jpg' .它可能类似于img_path = '/content/drive/My Drive/sample.jpg'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM