使用Labelimg标注出现错误:ValueError: not enough values to unpack (expected 5, got 1)

Traceback (most recent call last):
  File "D:\anaconda\b\envs\labelimg\lib\site-packages\labelImg\labelImg.py", line 1376, in open_next_image
    self.load_file(filename)
  File "D:\anaconda\b\envs\labelimg\lib\site-packages\labelImg\labelImg.py", line 1111, in load_file
    self.show_bounding_box_from_annotation_file(file_path)
  File "D:\anaconda\b\envs\labelimg\lib\site-packages\labelImg\labelImg.py", line 1154, in show_bounding_box_from_annotation_file
    self.load_yolo_txt_by_filename(txt_path)
  File "D:\anaconda\b\envs\labelimg\lib\site-packages\labelImg\labelImg.py", line 1557, in load_yolo_txt_by_filename
    t_yolo_parse_reader = YoloReader(txt_path, self.image)
  File "D:\anaconda\b\envs\labelimg\lib\site-packages\libs\yolo_io.py", line 112, in __init__
    self.parse_yolo_format()
  File "D:\anaconda\b\envs\labelimg\lib\site-packages\libs\yolo_io.py", line 142, in parse_yolo_format
    class_index, x_center, y_center, w, h = bndBox.strip().split(' ')
ValueError: not enough values to unpack (expected 5, got 1)

错误翻译:期待返回5个值,只返回了1个。

错误原因:存在回车键(对应的txt文件或下一个)

解决办法:检查对应的文件txt是否有多余回车键,删掉。使用Labelimg标注出现错误:ValueError: not enough values to unpack (expected 5, got 1)_第1张图片

 没有多余行,就能解决问题了。

你可能感兴趣的:(python)