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 FirstDetection.py
from imageai.Detection import ObjectDetection
import os
execution_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path ,
"cat2.jpg"),
output_image_path=os.path.join(execution_path ,
"cat2_detect.jpg"))
for eachObject in detections:
print(eachObject["name"] , " : " , eachObject["percentage_probability"] )
$ python FirstDetection.py
(Using Tensorflow 1.14, as most recent Tensorflow (v2) throws error.
https://github.com/OlafenwaMoses/ImageAI/issues/367
Bonus update (20 April 2020)

