imageai object detection vs cat: Dog, cat, or toilet paper?

Dog, cat, or toilet paper?

Click to enlarge


 2002  pip3 install tensorflow==1.14
 2003  pip3 install opencv-python
 2004  pip3 install keras
 2005  pip3 install imageai --upgrade

$ vi

from imageai.Detection import ObjectDetection
import os

execution_path = os.getcwd()

detector = ObjectDetection()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path ,
                                output_image_path=os.path.join(execution_path ,

for eachObject in detections:
    print(eachObject["name"] , " : " , eachObject["percentage_probability"] )

$ python


(Using Tensorflow 1.14, as most recent Tensorflow (v2) throws error.


Bonus update (20 April 2020)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.