yolov5训练时显示文件损坏WARNING: Ignoring corrupted image

在Python的datasets.py文件中,有一段代码用于验证JPEG图片是否损坏。这段代码通过检查图片文件的尾部两个字节是否为'xffxd9'来判断。现在,根据指令,这段代码被注释掉了,这可能会影响图片质量检查的步骤。注释的代码包括对'jpg'和'jpeg'格式的检查,文件打开,以及使用assert语句进行校验。

在datasets.py文件里面
找到下面四行

if im.format.lower() in (‘jpg’, ‘jpeg’):
with open(im_file, ‘rb’) as f:
f.seek(-2, 2)
assert f.read() == b’\xff\xd9’, ‘corrupted JPEG’

注释掉它们。

if im.format.lower() in (‘jpg’, ‘jpeg’):

with open(im_file, ‘rb’) as f:

f.seek(-2, 2)

assert f.read() == b’\xff\xd9’, ‘corrupted JPEG’

train: WARNING: Ignoring corrupted image and/or label datasets/images/train/001.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/002.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/003.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/004.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/005.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/006.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/007.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/008.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/009.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/010.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/011.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/012.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/013.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/014.png: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/015.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/021.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/022.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/023.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/024.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/025.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/026.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/027.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/028.png: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/029.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/030.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/031.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/032.jpg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/033.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/034.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/035.jpeg: name 'float32' is not defined train: WARNING: Ignoring corrupted image and/or label datasets/images/train/036.jpg: name 'float32' is not defined Traceback (most recent call last): File "train.py", line 620, in <module> main(opt) File "train.py", line 517, in main train(opt.hyp, opt, device, callbacks) File "train.py", line 210, in train train_loader, dataset = create_dataloader(train_path, imgsz, batch_size // WORLD_SIZE, gs, single_cls, File "/home/wsy/yolov5/utils/datasets.py", line 99, in create_dataloader dataset = LoadImagesAndLabels(path, imgsz, batch_size, File "/home/wsy/yolov5/utils/datasets.py", line 435, in __init__ labels, shapes, self.segments = zip(*cache.values()) ValueError: not enough values to unpack (expected 3, got 0) 如何解决以上问题 使yolo5成功运行
08-15
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值