qq_43593911 2022-04-05 21:57 采纳率: 50%
浏览 598
已结题

YOLOv5(PyTorch)实战:训练自己的数据集课程中遇到的问题

问题遇到的现象和发生背景

第四章的训练自己的数据集中,运行python train.py --data data/voc_ball.yaml --cfg models/yolov5s_ball.yaml --weights weights/yolov5s.pt --batch-size 16 --epochs 50 --workers 4 后,出现的结果与视频中的结果不一样

问题相关代码,请勿粘贴截图

(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
fatal: unable to access 'https://github.com/ultralytics/yolov5.git/': OpenSSL SSL_read: Connection was reset, errno 10054
Command 'git fetch && git config --get remote.origin.url' timed out after 5 seconds
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: Tracking run with wandb version 0.12.11
wandb: Run data is saved locally in D:\yolov5-ball\wandb\run-20220405_213117-2w27arkm
wandb: Run `wandb offline` to turn off syncing.
wandb: Syncing run proud-snowball-5
wandb:  View project at https://wandb.ai/smitty/train
wandb:  View run at https://wandb.ai/smitty/train/runs/2w27arkm
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 proud-snowball-5: https://wandb.ai/smitty/train/runs/2w27arkm
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-20220405_213117-2w27arkm\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
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (10/10), done.
remote: Total 13 (delta 10), reused 10 (delta 10), pack-reused 3
Unpacking objects: 100% (13/13), 2.13 KiB | 48.00 KiB/s, done.
From https://github.com/ultralytics/yolov5
   5f97001..b1300f3  master     -> origin/master
github:  YOLOv5 is out of date by 25 commits. Use `git pull` or `git clone https://github.com/ultralytics/yolov5` to update.
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: Tracking run with wandb version 0.12.11
wandb: Run data is saved locally in D:\yolov5-ball\wandb\run-20220405_213713-38uv56f4
wandb: Run `wandb offline` to turn off syncing.
wandb: Syncing run dauntless-butterfly-6
wandb:  View project at https://wandb.ai/smitty/train
wandb:  View run at https://wandb.ai/smitty/train/runs/38uv56f4
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.
Exception in thread StatsThr: uploaded (0.000 MB deduped)
Traceback (most recent call last):
  File "C:\Users\W\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Users\W\Anaconda3\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\W\Anaconda3\lib\site-packages\wandb\sdk\internal\stats.py", line 148, in _thread_body
    self.flush()
  File "C:\Users\W\Anaconda3\lib\site-packages\wandb\sdk\internal\stats.py", line 162, in flush
    stats = self.stats()
  File "C:\Users\W\Anaconda3\lib\site-packages\wandb\sdk\internal\stats.py", line 186, in stats
    in_use_by_us = gpu_in_use_by_this_process(handle)
  File "C:\Users\W\Anaconda3\lib\site-packages\wandb\sdk\internal\stats.py", line 57, in gpu_in_use_by_this_process
    for process in pynvml.nvmlDeviceGetGraphicsRunningProcesses(gpu_handle)
  File "C:\Users\W\Anaconda3\lib\site-packages\wandb\vendor\pynvml\pynvml.py", line 1334, in nvmlDeviceGetGraphicsRunningProcesses
    ret = fn(handle, byref(c_count), c_procs)
OSError: exception: access violation reading 0x000001F474380000

wandb:
wandb: Synced dauntless-butterfly-6: https://wandb.ai/smitty/train/runs/38uv56f4
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-20220405_213713-38uv56f4\logs

运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果

希望能够帮我解答一下,达到视频中的结果

  • 写回答

1条回答 默认 最新

  • 爱晚乏客游 2022-04-06 09:26
    关注

    in "models/yolov5s_ball.yaml", line 5, column 1
    检查以下这个文件,这里出现的错误

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 4月14日
  • 已采纳回答 4月6日
  • 创建了问题 4月5日

悬赏问题

  • ¥15 电信IPV6 无法外网访问吗
  • ¥15 有偿求效果比较好的遥感影像匹配的c++代码
  • ¥15 博主,你好,我下载了你的智能网联汽车辅助驾驶安全信息检测系统,现在不会运行,可以教我吗,
  • ¥15 怎么在excle输入下列公式
  • ¥15 Arduino,利用modbus的RS485协议,进行对外置的温湿度传感器进行数据读取
  • ¥15 vhdl+MODELSIM
  • ¥20 simulink中怎么使用solve函数?
  • ¥30 dspbuilder中使用signalcompiler时报错Error during compilation: Fitter failed,求解决办法
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题