简体   繁体   中英

Import Image from Google Drive to Google Colab

I have mounted my Google drive to my colab notebook:

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

I can import csv files through it, in my case:

df = pd.read_csv("/content/gdrive/MyDrive/colab/heart-disease.csv")

But when I try to import images in markdown/text in colab nothing happens:

![](/content/gdrive/MyDrive/colab/6-step-ml-framework.png)

Here's my directory on Google drive:

目录

You can using OpenCV in colab by import cv2 as cv , read image by img = cv.imread('/content/gdrive/MyDrive/colab/6-step-ml-framework.png') , convert image to numpy array using img = np.float32(img)

@Mr. For Example you should not use np.float(img) , because OpenCV's method imread has converted it to np.array already

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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