问题遇到的现象和发生背景
修改models_yolov5_ball.yaml文件之后,再次运行python train.py --data data/voc_ball.yaml --cfg models/yolov5s_ball.yaml --weights weights/yolov5s.pt --batch-size 16 --epochs 50 --workers 4 后,出现的结果中,前一部分与视频中的结果一样,后一部分仍然出现错误。
问题相关代码,请勿粘贴截图
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
train: weights=weights/yolov5s.pt, cfg=models/yolov5s_ball.yaml, data=data/voc_ball.yaml, hyp=data\hyps\hyp.scratch-low.yaml, epochs=50, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=4, project=runs\train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest
github: skipping check (offline), for updates see https://github.com/ultralytics/yolov5
YOLOv5 v6.1-77-gdf9008e torch 1.10.2+cpu CPU
hyperparameters: lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0
TensorBoard: Start with 'tensorboard --logdir runs\train', view at http://localhost:6006/
wandb: wandb version 0.12.12 is available! To upgrade, please run:
wandb: $ pip install wandb --upgrade
wandb: Tracking run with wandb version 0.12.11
wandb: Run data is saved locally in D:\yolov5-ball\wandb\run-20220406_194309-3h34ix2a
wandb: Run `wandb offline` to turn off syncing.
wandb: Syncing run andorian-t-pol-7
wandb: View project at https://wandb.ai/smitty/train
wandb: View run at https://wandb.ai/smitty/train/runs/3h34ix2a
Traceback (most recent call last):
File "train.py", line 645, in <module>
main(opt)
File "train.py", line 541, in main
train(opt.hyp, opt, device, callbacks)
File "train.py", line 124, in train
model = Model(cfg or ckpt['model'].yaml, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device) # create
File "D:\yolov5-ball\models\yolo.py", line 97, in __init__
self.yaml = yaml.safe_load(f) # model dict
File "C:\Users\W\Anaconda3\lib\site-packages\yaml\__init__.py", line 125, in safe_load
return load(stream, SafeLoader)
File "C:\Users\W\Anaconda3\lib\site-packages\yaml\__init__.py", line 81, in load
return loader.get_single_data()
File "C:\Users\W\Anaconda3\lib\site-packages\yaml\constructor.py", line 49, in get_single_data
node = self.get_single_node()
File "C:\Users\W\Anaconda3\lib\site-packages\yaml\composer.py", line 39, in get_single_node
if not self.check_event(StreamEndEvent):
File "C:\Users\W\Anaconda3\lib\site-packages\yaml\parser.py", line 98, in check_event
self.current_event = self.state()
File "C:\Users\W\Anaconda3\lib\site-packages\yaml\parser.py", line 174, in parse_document_start
self.peek_token().start_mark)
yaml.parser.ParserError: expected '<document start>', but found '<block mapping start>'
in "models/yolov5s_ball.yaml", line 5, column 1
wandb: Waiting for W&B process to finish... (failed 1). Press Ctrl-C to abort syncing.
wandb:
wandb: Synced andorian-t-pol-7: https://wandb.ai/smitty/train/runs/3h34ix2a
wandb: Synced 6 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s)
wandb: Find logs at: .\wandb\run-20220406_194309-3h34ix2a\logs
(base) D:\yolov5-ball>python train.py --data data/voc_ball.yaml --cfg models/yolov5s_ball.yaml --weights weights/yolov5s.pt --batch-size 16 --epochs 50 --workers 4
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
train: weights=weights/yolov5s.pt, cfg=models/yolov5s_ball.yaml, data=data/voc_ball.yaml, hyp=data\hyps\hyp.scratch-low.yaml, epochs=50, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=4, project=runs\train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest
github: skipping check (offline), for updates see https://github.com/ultralytics/yolov5
YOLOv5 v6.1-77-gdf9008e torch 1.10.2+cpu CPU
hyperparameters: lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0
TensorBoard: Start with 'tensorboard --logdir runs\train', view at http://localhost:6006/
wandb: wandb version 0.12.12 is available! To upgrade, please run:
wandb: $ pip install wandb --upgrade
wandb: Tracking run with wandb version 0.12.11
wandb: Run data is saved locally in D:\yolov5-ball\wandb\run-20220406_195120-3198c2cv
wandb: Run `wandb offline` to turn off syncing.
wandb: Syncing run trill-space-8
wandb: View project at https://wandb.ai/smitty/train
wandb: View run at https://wandb.ai/smitty/train/runs/3198c2cv
from n params module arguments
0 -1 1 3520 models.common.Focus [3, 32, 3]
1 -1 1 18560 models.common.Conv [32, 64, 3, 2]
2 -1 1 18816 models.common.C3 [64, 64, 1]
3 -1 1 73984 models.common.Conv [64, 128, 3, 2]
4 -1 3 156928 models.common.C3 [128, 128, 3]
5 -1 1 295424 models.common.Conv [128, 256, 3, 2]
6 -1 3 625152 models.common.C3 [256, 256, 3]
7 -1 1 1180672 models.common.Conv [256, 512, 3, 2]
8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]]
9 -1 1 1182720 models.common.C3 [512, 512, 1, False]
10 -1 1 131584 models.common.Conv [512, 256, 1, 1]
11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
12 [-1, 6] 1 0 models.common.Concat [1]
13 -1 1 361984 models.common.C3 [512, 256, 1, False]
14 -1 1 33024 models.common.Conv [256, 128, 1, 1]
15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
16 [-1, 4] 1 0 models.common.Concat [1]
17 -1 1 90880 models.common.C3 [256, 128, 1, False]
18 -1 1 147712 models.common.Conv [128, 128, 3, 2]
19 [-1, 14] 1 0 models.common.Concat [1]
20 -1 1 296448 models.common.C3 [256, 256, 1, False]
21 -1 1 590336 models.common.Conv [256, 256, 3, 2]
22 [-1, 10] 1 0 models.common.Concat [1]
23 -1 1 1182720 models.common.C3 [512, 512, 1, False]
24 [17, 20, 23] 1 16182 models.yolo.Detect [1, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]
YOLOv5s_ball summary: 283 layers, 7063542 parameters, 7063542 gradients, 16.4 GFLOPs
Transferred 354/361 items from weights\yolov5s.pt
Scaled weight_decay = 0.0005
optimizer: SGD with parameter groups 59 weight (no decay), 62 weight, 62 bias
train: Scanning 'D:\yolov5-ball\VOCdevkit\labels\train' images and labels...: 0%| | 0/1117 [00:00<?, ?it/s] wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
train: Scanning 'D:\yolov5-ball\VOCdevkit\labels\train' images and labels...1 found, 0 missing, 0 empty, 0 corrupt: 0wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
train: Scanning 'D:\yolov5-ball\VOCdevkit\labels\train' images and labels...221 found, 0 missing, 0 empty, 0 corrupt: wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
train: Scanning 'D:\yolov5-ball\VOCdevkit\labels\train' images and labels...1117 found, 0 missing, 0 empty, 0 corrupt:
train: New cache created: D:\yolov5-ball\VOCdevkit\labels\train.cache
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
wandb: Currently logged in as: smitty (use `wandb login --relogin` to force relogin)
Traceback (most recent call last):
File "train.py", line 645, in <module>
main(opt)
File "train.py", line 541, in main
train(opt.hyp, opt, device, callbacks)
File "train.py", line 230, in train
assert mlc < nc, f'Label class {mlc} exceeds nc={nc} in {data}. Possible class labels are 0-{nc - 1}'
AssertionError: Label class 1 exceeds nc=1 in data/voc_ball.yaml. Possible class labels are 0-0
wandb: Waiting for W&B process to finish... (failed 1). Press Ctrl-C to abort syncing.
wandb:
wandb: Synced trill-space-8: https://wandb.ai/smitty/train/runs/3198c2cv
wandb: Synced 6 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s)
wandb: Find logs at: .\wandb\run-20220406_195120-3198c2cv\logs