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

执行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 yolov5 双模态检测
    • ¥15 gradle项目报错
    • ¥60 有关C#的问题,基础牢固的来
    • ¥15 Python算法设计Seam carving--让图片比例随心缩放
    • ¥15 页面制作,HTML CSS
    • ¥15 通个批处理实现 win7和win10 修改或设置:显示操作系统列表时间为2秒
    • ¥20 报错:Unsupported class file major version 59
    • ¥15 用ASP代码实现跨站脚本攻击
    • ¥50 ABP中怎样接收vue上传的图片