如何解决imageai自定义训练的YOLOv3模型未检测到对象
通过跟踪https://imageai.readthedocs.io/en/latest/customdetection/index.html
链接,我训练了自己的YOlov3模型以进行对象检测。我使用的代码是:
from imageai.Detection.Custom import DetectionModelTrainer
trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOlov3()
trainer.setDataDirectory(data_directory="Category 2")
trainer.setTrainConfig(object_names_array=["Category 2"],batch_size=2,num_experiments=9)
trainer.trainModel()
我使用tensorflow 1.13.1(cpu),keras 2.2.4创建了模型,损失值为7.562。当我使用以下代码在图像上运行此模型时:
detector = CustomObjectDetection()
detector.setModelTypeAsYOlov3()
detector.setModelPath("detection_model-ex-009--loss-0007.562.h5")
detector.setJsonPath("detection_config.json")
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image="image.jpg",output_image_path="detected.jpg")
for detection in detections:
print(detection["name"]," : ",detection["percentage_probability"],detection["Box_points"])
即使我在训练或测试图像上运行代码,代码也可以正常运行,但什么也检测不到。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。