Skip to content

Instantly share code, notes, and snippets.

@OlafenwaMoses
Created August 1, 2019 13:40
Show Gist options
  • Save OlafenwaMoses/d399e61386fc4adb4e67e834cde50c00 to your computer and use it in GitHub Desktop.
Save OlafenwaMoses/d399e61386fc4adb4e67e834cde50c00 to your computer and use it in GitHub Desktop.
Code for detection Hololens in pictures using a trained custom model
from imageai.Detection.Custom import CustomObjectDetection
detector = CustomObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath("hololens-ex-60--loss-2.76.h5")
detector.setJsonPath("detection_config.json")
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image="holo3.jpg", output_image_path="holo3-detected.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