_Sage_爱学习 2022-10-05 17:48 采纳率: 50%
浏览 69
已结题

执行yolov6推理命令后报错问题

刚刚参照白老师YOLOv6目标检测实战视频中的方式,执行命令python tools/infer.py --weights weights/yolov6s.pt --source data/images后出现以下报错。怎样解决
(mypytorch) D:\projects\GitHub\yolov6\YOLOv6>python tools/infer.py --weights weights/yolov6s.pt --source data/images
Namespace(agnostic_nms=False, classes=None, conf_thres=0.4, device='0', half=False, hide_conf=False, hide_labels=False, img_size=[640, 640], iou_thres=0.45, max_det=1000, name='exp', project='runs/inference', save_dir=None, save_img=True, save_txt=False, source='data/images', view_img=False, weights='weights/yolov6s.pt', yaml='data/coco.yaml')
Save directory already existed
Loading checkpoint from weights/yolov6s.pt

Fusing model...
Switch model to deploy modality.
Traceback (most recent call last):
  File "tools/infer.py", line 116, in <module>
    main(args)
  File "tools/infer.py", line 111, in main
    run(**vars(args))
  File "D:\ProgramFiles\Anaconda3\envs\mypytorch\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "tools/infer.py", line 103, in run
    inferer = Inferer(source, weights, device, yaml, img_size, half)
  File "D:\projects\GitHub\yolov6\YOLOv6\yolov6\core\inferer.py", line 50, in __init__
    self.model(torch.zeros(1, 3, *self.img_size).to(self.device).type_as(next(self.model.model.parameters())))  # warmup
  File "D:\ProgramFiles\Anaconda3\envs\mypytorch\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "D:\projects\GitHub\yolov6\YOLOv6\yolov6\layers\common.py", line 360, in forward
    y, _ = self.model(im)
  File "D:\ProgramFiles\Anaconda3\envs\mypytorch\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "D:\projects\GitHub\yolov6\YOLOv6\yolov6\models\yolo.py", line 44, in forward
    x = self.detect(x)
  File "D:\ProgramFiles\Anaconda3\envs\mypytorch\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "D:\projects\GitHub\yolov6\YOLOv6\yolov6\models\effidehead.py", line 101, in forward
    x, self.stride, self.grid_cell_size, self.grid_cell_offset, device=x[0].device, is_eval=True)
  File "D:\ProgramFiles\Anaconda3\envs\mypytorch\lib\site-packages\torch\nn\modules\module.py", line 1207, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Detect' object has no attribute 'grid_cell_size'

img

  • 写回答

1条回答 默认 最新

报告相同问题?

问题事件

  • 系统已结题 10月13日
  • 已采纳回答 10月5日
  • 修改了问题 10月5日
  • 创建了问题 10月5日

悬赏问题

  • ¥15 有没有能解决微信公众号,只能实时拍照,没有选择相册上传功能,我不懂任何技术,,有没有给我发个软件就能搞定的方法
  • ¥15 Pythontxt文本可视化
  • ¥15 如何基于Ryu环境下使用scapy包进行数据包构造
  • ¥15 springboot国际化
  • ¥15 搭建QEMU环境运行OP-TEE出现错误
  • ¥15 Minifilter文件保护
  • ¥15 有限元软件终止时间超过设定值
  • ¥15 onvif框架引用一直报错
  • ¥50 C#和C++混合编程,使用CLR托管,报错System.Runtime.InteropServices.SEHException
  • ¥30 .NET使用sqlite发布后报错