如何修复输入图像、输入/输出类型/图像路径的 YOLOV3 值错误?

问题描述

我训练了一个 Yolov3 权重文件并将其转换为 .h5,在运行我的检测器时出现错误

这是检测器的代码

from imageai.Detection import ObjectDetection

detector = ObjectDetection()
model_path = "./models/model.h5"
input_path = "./input/test1.jpg"
output_path = "./output/newimage.jpg"
detector.setModelTypeAsYOlov3()
detector.setModelPath(model_path)
detector.loadModel()

detection = detector.detectObjectsFromImage(input_image=input_path,output_image_path=output_path)

for eachItem in detection:
    print(eachItem["name"]," : ",eachItem["percentage_probability"])

完整的错误信息:

Traceback (most recent call last):
  File "C:\Users\Aidan\AppData\Local\Programs\Python\python37\lib\site-packages\imageai\Detection\__init__.py",line 306,in detectObjectsFromImage
    self.numbers_to_names)
  File "C:\Users\Aidan\AppData\Local\Programs\Python\python37\lib\site-packages\imageai\Detection\YOLO\utils.py",line 308,in retrieve_yolo_detections
    correct_yolo_Boxes(Boxes,image_size[1],image_size[0],image_input_size[0],image_input_size[1])
  File "C:\Users\Aidan\AppData\Local\Programs\Python\python37\lib\site-packages\imageai\Detection\YOLO\utils.py",line 145,in correct_yolo_Boxes
    Boxes[i].xmin = int((Boxes[i].xmin - x_offset) / x_scale * image_w)
ValueError: cannot convert float NaN to integer

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "detector.py",line 12,in <module>
    detection = detector.detectObjectsFromImage(input_image=input_path,output_image_path=output_path)
  File "C:\Users\Aidan\AppData\Local\Programs\Python\python37\lib\site-packages\imageai\Detection\__init__.py",line 392,in detectObjectsFromImage
    "Ensure you specified correct input image,input type,output type and/or output image path ")
ValueError: Ensure you specified correct input image,output type and/or output image path

我该如何解决这个错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)