meituan / YOLOv6

YOLOv6: a single-stage object detection framework dedicated to industrial applications.
GNU General Public License v3.0
5.71k stars 1.03k forks source link

YOLOv6-Face onnx 无法正常导出 #838

Open David-19940718 opened 1 year ago

David-19940718 commented 1 year ago

Before Asking

Search before asking

Question

分支:yolov6-face 权重:https://github.com/meituan/YOLOv6/releases/download/0.4.0/yolov6lite_s_face.pt 脚本:python deploy/ONNX/export_onnx.py --weights weights/yolov6lite_s_face.pt --simplify --img-size 416 416 --ort

报错:

Namespace(batch_size=1, conf_thres=0.4, device='0', dynamic_batch=False, end2end=False, half=False, img_size=[416, 416], inplace=False, iou_thres=0.45, ort=True, simplify=True, topk_all=100, trt_version=8, weights='weights/yolov6lite_s_face.pt', with_preprocess=False)
Loading checkpoint from weights/yolov6lite_s_face.pt

Fusing model...
Traceback (most recent call last):
  File "deploy/ONNX/export_onnx.py", line 62, in <module>
    if isinstance(m, Conv):  # assign export-friendly activations
NameError: name 'Conv' is not defined

发现目前只有这个能正常推理:

python tools/infer.py --source data/images/test.jpg --weights weights/yolov6lite_s_face.pt --img-size 416 416

Additional

No response

Chilicyy commented 1 year ago

您好,已更新代码了,麻烦重新拉下代码重试一下。

David-19940718 commented 1 year ago

您好,已更新代码了,麻烦重新拉下代码重试一下。

您好,可以正常导出lite模型。但目前 yolov6s_face.pt 无法正常推理。

AttributeError: Can't get attribute 'Conv_C3' on <module 'yolov6.layers.common' from './YOLOv6/yolov6/layers/common.py'>

Chilicyy commented 1 year ago

您好,由于我们最近的代码对卷积算子定义进行了重构,麻烦从4.0 release中重新下载对应的预训练权重。

David-19940718 commented 1 year ago

您好,由于我们最近的代码对卷积算子定义进行了重构,麻烦从4.0 release中重新下载对应的预训练权重。

您好,测试了下,yolov6lite系列均能正常导出。yolov6n_face.pt和yolov6m_face.pt能正常导出。

yolov6s_face.pt报以下错误:

AttributeError: Can't get attribute 'Conv_C3' on <module 'yolov6.layers.common'
Chilicyy commented 1 year ago

您好,麻烦确认下您的权重文件是否有从4.0 release中重新下载。