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 (将#修改为@)