Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. from imageai.Detection import ObjectDetection
  2. import os
  3.  
  4. execution_path = os.getcwd()
  5.  
  6. detector = ObjectDetection()
  7. detector.setModelTypeAsRetinaNet()
  8. detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
  9. detector.loadModel()
  10. detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpg"), output_image_path=os.path.join(execution_path , "imagenew.jpg"))
  11.  
  12. for eachObject in detections:
  13.     print(eachObject["name"] , " : " , eachObject["percentage_probability"] )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement