imageai специально обученная модель YOLOv3 не обнаруживает объекты
Я обучил свою собственную модель YOLOv3 для обнаружения объектов, перейдя по этой ссылке https://imageai.readthedocs.io/en/latest/customdetection/index.html
Я использовал следующий код:
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"])
Код работает нормально, но ничего не обнаруживает, даже когда я запускаю его на обучающих или тестовых изображениях.