Created
December 9, 2018 15:58
-
-
Save Shohjahon/7ef52681914e1abaf781781ba12a3c75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 , "image.jpg"), output_image_path=os.path.join(execution_path , "imagenew.jpg")) | |
for eachObject in detections: | |
print(eachObject["name"] , " : " , eachObject["percentage_probability"] ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment