Skip to content

How to properly inference YOLOv6-L6 onnx? #1021

Description

@HeChengHui

Before Asking

  • I have read the README carefully. 我已经仔细阅读了README上的操作指引。

  • I want to train my custom dataset, and I have read the tutorials for training your custom data carefully and organize my dataset correctly; (FYI: We recommand you to apply the config files of xx_finetune.py.) 我想训练自定义数据集,我已经仔细阅读了训练自定义数据的教程,以及按照正确的目录结构存放数据集。(FYI: 我们推荐使用xx_finetune.py等配置文件训练自定义数据集。)

  • I have pulled the latest code of main branch to run again and the problem still existed. 我已经拉取了主分支上最新的代码,重新运行之后,问题仍不能解决。

Search before asking

  • I have searched the YOLOv6 issues and found no similar questions.

Question

I am trying to inference YOLOv6-L6 on onnxruntime

torch 2.1.0+cu118 pypi_0 pypi
torchvision 0.16.0+cu118 pypi_0 pypi
onnx 1.15.0 pypi_0 pypi
onnx-simplifier 0.4.35 pypi_0 pypi
onnxruntime-gpu 1.17.0 pypi_0 pypi
onnxscript 0.1.0.dev20240207 pypi_0 pypi

  1. when i tried to run python deploy/ONNX/OpenCV/yolo_video.py --model "yolov6l6.onnx", the speed is super slow.
  2. tried follow the tutorial here but when i export using
python deploy/ONNX/export_onnx.py \
    --weights weights/yolov6.pt \
    --end2end --simplify \
    --topk-all 100 \
    --iou-thres 0.65 \
    --conf-thres 0.35 \
    --img-size 640 640 \
    --dynamic-batch \
    --ort \

i get the error: onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from YOLO/YOLOv6/yolov6l6.onnx failed:Type Error: Type parameter (T) of Optype (Where) bound to different types (tensor(int64) and tensor(float) in node (/end2end/Where_1).

It works when i remove --end2end but the output becomes outname=['outputs'] instead of ['num_dets', 'det_boxes', 'det_scores', 'det_classes']

Additional

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions