YOLOV5训练数据集过程中特殊问题记录
项⽬场景:
容器英文yolov5训练GX数据集
问题描述:
运⾏train.py
Traceback (most recent call last):
金针菇的英文File "/home/milk/yolov52/train.py", line 484, in <module>
train(hyp, opt, device, tb_writer)
File "/home/milk/yolov52/train.py", line 191, in train
dataloader, datat = create_dataloader(train_path, imgsz, batch_size, gs, opt, hyp=hyp, augment=True,
File "/home/milk/y
Traceback (most recent call last):
上海新科
File "/home/milk/yolov52/train.py", line 484, in <module>
train(hyp, opt, device, tb_writer)
File "/home/milk/yolov52/train.py", line 191, in train
dataloader, datat = create_dataloader(train_path, imgsz, batch_size, gs, opt, hyp=hyp, augment=True,
communistpartyFile "/home/milk/yolov52/utils/datats.py", line 53, in create_dataloader
datat = LoadImagesAndLabels(path, imgsz, batch_size,
File "/home/milk/yolov52/utils/datats.py", line 381, in __init__倒霉熊第2部
asrt (l >= 0).all(), 'negative labels: %s' % filepeach
AsrtionError: negative labels: /home/milk/yolov52/GX0/labels/
原因分析:
提⽰是出现了负标签,对⽐xml之后发现,只有这⼀个txt中出现如下情况maitland
<
2 1.6194444444444445 1.413580246913580reincarnation
3 -
1.2416666666666667 -0.8320987654320987僵尸预警指南
0 2.3583333333333334 2.15679012345679 -
2.7194444444444446 -2.3185185185185184
behold0 2.702777777777778 1.3222222222222222 -
3.4083333333333337 -0.6493827160493827
<
0 0.06041666666666667 0.32469135802469135
0.11527777777777778 0.15061728395061727
0 0.2777777777777778 0.0728395061728395
0.03888888888888889 0.08148148148148147
在这⾥要注意txt中的类别和xml中是对应的
解决⽅案:
1. 查xml转txt原理,判断是否程序出问题
xml转txt时,在计算xmin、xmax、ymin、ymax部分会出现max值⼤于min,在进⾏旋转操作后max⼩于min-----位置互换,导致出现负值,修改⽣成标签部分代码,使得⽣成h部分为绝对值。数据增强尤其关注啊
2. 暴⼒排除,直接删除