tugstugi/dl-colab-notebooks

YOLOv3_Pytorch notebook command to read image from folder

nyck33 opened this issue · 1 comments

In the final cell, I am trying to:

#!cd pytorch-yolo-v3 && python detect.py --weights ../yolov3.weights --images ../$image_file --det ..
!cd pytorch-yolo-v3 && python detect.py --weights ../yolov3.weights --images $image_file --det ..
plt.figure(figsize=(20, 15))
#plt.imshow(matplotlib.image.imread('det_%s' % image_file))
plt.imshow(matplotlib.image.imread(image_file))

but getting an error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-13-f0b6ab42b24b> in <module>()
      2 plt.figure(figsize=(20, 15))
      3 #plt.imshow(matplotlib.image.imread('det_%s' % image_file))
----> 4 plt.imshow(matplotlib.image.imread(image_file))

/usr/local/lib/python3.6/dist-packages/matplotlib/image.py in imread(fname, format)
   1367                 return handler(fd)
   1368     else:
-> 1369         return handler(fname)
   1370 
   1371 

TypeError: Object does not appear to be a 8-bit string path or a Python file-like object

How can I change the command to use an image uploaded to Colab, sitting in /content/image.jpg that was read in the previous cell with:

image_file =mpimg.imread('/content/frame1290.jpg')
plt.imshow(image_file)

Hey sorry, I just looked up the original github repo and figured it out.