Skip to content

Instantly share code, notes, and snippets.

@OlafenwaMoses
Last active August 30, 2019 14:39
Show Gist options
  • Save OlafenwaMoses/175c4c5b47e3fe8fbb91038b6f026c8a to your computer and use it in GitHub Desktop.
Save OlafenwaMoses/175c4c5b47e3fe8fbb91038b6f026c8a to your computer and use it in GitHub Desktop.
from imageai.Detection.Custom import CustomObjectDetection
import os
execution_path = os.getcwd()
detector = CustomObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath(detection_model_path="detection_model-ex-028--loss-8.723.h5")
detector.setJsonPath(configuration_json="detection_config.json")
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image="image.jpg", minimum_percentage_probability=60, output_image_path="image-new.jpg")
for detection in detections:
print(detection["name"], " : ", detection["percentage_probability"], " : ", detection["box_points"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment