CustomDetection.py 639 B

1234567891011
  1. from imageai.Detection.Custom import CustomObjectDetection
  2. detector = CustomObjectDetection()
  3. detector.setModelTypeAsYOLOv3()
  4. detector.setModelPath("roland_esl_3_440_ye/models/detection_model-ex-002--loss-0019.457.h5")
  5. detector.setJsonPath("roland_esl_3_440_ye/json/detection_config.json")
  6. detector.loadModel()
  7. detections = detector.detectObjectsFromImage(input_image="10120174_11.jpg", output_image_path="holo2-detected.jpg",
  8. minimum_percentage_probability=30)
  9. for detection in detections:
  10. print(detection["name"], ": ", detection["percentage_probability"], ": ", detection["box_points"])