我正在尝试训练一个yolov5模型,但是当我试图执行训练模块时,我会得到一个异常错误。此错误发生在加载模型和尝试读取培训图像之后。下面是我的代码和错误的摘录。任何帮助都将不胜感激。
!python train.py --img 640 --batch 16 --epochs 150 --data pollen_data.yaml --weights yolov5x.pt
Model summary: 567 layers, 86217814 parameters, 86217814 gradients, 204.2 GFLOPs
Transferred 739/745 items from yolov5x.pt
Scaled weight_decay = 0.0005
optimizer: SGD with parameter groups 123 weight (no decay), 126 weight, 126 bias
albumentations: version 1.0.3 required by YOLOv5, but version 0.1.12 is currently installed
Traceback (most recent call last):
File "/content/yolov5/utils/datasets.py", line 405, in __init__
t = t.read().strip().splitlines()
File "/usr/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 643, in <module>
main(opt)
File "train.py", line 539, in main
train(opt.hyp, opt, device, callbacks)
File "train.py", line 227, in train
prefix=colorstr('train: '), shuffle=True)
File "/content/yolov5/utils/datasets.py", line 110, in create_dataloader
prefix=prefix)
File "/content/yolov5/utils/datasets.py", line 415, in __init__
raise Exception(f'{prefix}Error loading data from {path}: {e}\nSee {HELP_URL}')
Exception: train: Error loading data from /content/datasets/images/training/im0.jpg: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte谢谢。
发布于 2022-03-25 04:17:16
在过去的一个月里,我一直在使用yolov5,我必须说,您的错误是错误的。而且,你也不能训练你的模型的图像大小为12000。默认情况下,它应该是640。在您的情况下,它可能会根据您的数据集发生更改,但我非常肯定它不会是12000。
您的数据目录中也有一个错误。
--data /content/datasets/annotations/dataset.yaml.txt数据文件不会有'.txt‘扩展名。它应该是一个'.yaml‘文件。所以把它改成
--data /content/datasets/annotations/dataset.yaml在这些变化之后,它应该开始训练。如果没有,请关闭此问题,并提供更多信息并提出另一个问题。
发布于 2022-03-28 03:49:18
误差
'utf-8' codec can't decode byte 0xff in position 0: invalid start byte在使用默认未提及的格式图像时引发。
IMG_FORMATS = 'bmp', 'dng', 'jpeg', 'jpg', 'mpo', 'png', 'tif', 'tiff', 'webp' # include image suffixes
但你说过这是个jpg。我现在很困惑。此外,如果有帮助,请尝试这个问题提供的解决方案。链接
https://stackoverflow.com/questions/71551805
复制相似问题