Yolov5报错:
AssertionError: Label class 1 exceeds nc=1 in data/coco128.yaml. Possible class labels are 0-0
这个错别傻乎乎该nc之类的,细看代码出错位置,我这个是这样的

File “C:\Users\1\Desktop\水表识别\YOLO5\yolov5-master\train.py”, line 175, in train
assert mlc < nc, ‘Label class %g exceeds nc=%g in %s. Possible class labels are 0-%g’ % (mlc, nc, opt.data, nc - 1)

AssertionError: Label class 1 exceeds nc=1 in data/coco128.yaml. Possible class labels are 0-0

这样就找到train文件的175行:

assert mlc < nc, 'Label class %g exceeds nc=%g in %s. Possible class labels are 0-%g' % (mlc, nc, opt.data, nc - 1)

改成这样

#assert mlc < nc, 'Label class %g exceeds nc=%g in %s. Possible class labels are 0-%g' % (mlc, nc, opt.data, nc - 1)

即注销掉就可以了

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐