微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决如何修复输入图像、输入/输出类型/图像路径的 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 举报,一经查实,本站将立刻删除。