'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:

Directory



Solution 1:[1]

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)

Solution 2:[2]

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

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 Mr. For Example
Solution 2 Alexander APS