1

I am coding a Image Classificator using ResNet18. Train and Test phase work fine. But as a final I want to do a evaluation with 5-10 images. The classificator give out data, target and the images which are classified. Giving out data and target work fine too. But the classificator never shows the classified images to the user.

Running on my own GPU I used to use Show.img() .

I ve got my data on my Google Drive and mounted the data with from colab.google import drive etc.

Which code do I need to implement to show the images to the user.

Thanks for your help.

PS: I bet I missing a pretty easy answer, but I am running crazy.

VomDorfe
  • 51
  • 2
  • 5

3 Answers3

2

If you will need to upload an image, you can refer to this SO post:

import cv2
import numpy as np
from matplotlib import pyplot as plt

img = cv2.imread("Sample-image.jpg")
img_cvt=cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img_cvt)
plt.show()

Use this function to upload files. It will SAVE them as well.

Jessica Rodriguez
  • 2,899
  • 1
  • 12
  • 27
1

First you need to mount the drive. Open colab and press the mount button, as below

enter image description here

Next you will see a new directory called drive/MyDrive

enter image description here

You can read files from it using this python code.

import cv2
import matplotlib.pyplot as plt
img = cv2.imread('drive/MyDrive/test1.jpg')
plt.imshow(img)
John Henckel
  • 10,274
  • 3
  • 79
  • 79
0

Somthing like this

from IPython.display import Image

Image('drive/My Drive/folder/image.jpg')
Alejandro Silvestri
  • 3,706
  • 31
  • 43
korakot
  • 37,818
  • 16
  • 123
  • 144