附录:onnx导出说明

3.1. emanet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/emanet/emanet_r50-d8_512x1024_80k_cityscapes/emanet_r50-d8_512x1024_80k_cityscapes_20200901_100301-c43fcef1.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/emanet/emanet_r50-d8_512x1024_80k_cityscapes.py ./pretrained/emanet_r50-d8_512x1024_80k_cityscapes_20200901_100301-c43fcef1.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/emanet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/emanet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.2. agw-r101-pt-op13-fp32.onnx 转换

原始Codebase信息

  • https://github.com/JDAI-CV/fast-reid

  • commit id: 64861ea6c85122bbf8577c10bd7fc6e551495b3a

  • branch: v0.1.1

原始预训练模型

ONNX转换相关依赖

  • onnxoptimizer

  • onnxsim

  • yacs

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    CUDA_VISIBLE_DEVICES='' python3 tools/deploy/onnx_export.py --config-file configs/Market1501/AGW_R101-ibn.yml --name agw_r101 --output agw-r101-pt-op13-fp32.onnx --opts MODEL.DEVICE cpu MODEL.WEIGHTS <path/to/ckpt> INPUT.SIZE_TEST [128,64]
    
  • 转换完成后,在当前目录获得agw-r101-pt-op13-fp32.onnx

3.3. dnl_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp pspnet_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply pspnet_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/dnlnet/dnl_r50-d8_512x1024_80k_cityscapes/dnl_r50-d8_512x1024_80k_cityscapes_20200904_233629-58b2f778.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_static-1024x2048.py ../mmsegmentation/configs/dnlnet/dnl_r50-d8_512x1024_80k_cityscapes.py ./pretrained/dnl_r50-d8_512x1024_80k_cityscapes_20200904_233629-58b2f778.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/dnl_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/dnl_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx

3.4. tsm-r50-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/open-mmlab/mmaction2

  • commit id: 1485998e0dfde4dc369fcf072fe74dfe79d49e32

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • mmcv-full==1.5.0

  • mmaction2==0.24.0

  • mmdet

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    python3 tools/deployment/pytorch2onnx.py configs/recognition/tsm/tsm_r50_dense_1x1x8_100e_kinetics400_rgb.py <path/to/ckpt> --shape 1 80 3 224 224
    
  • 转换完成后,在当前目录获得tsm-r50-pt-op13-fp32.onnx

3.5. tsm-r50-official-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/mit-han-lab/temporal-shift-module

  • commit id: e12b79e9647314c1b07f9e161a4810f90f51b021

  • branch: master

原始预训练模型

  • https://hanlab.mit.edu/projects/tsm/models/TSM_kinetics_RGB_resnet50_shift8_blockres_avg_segment8_e100_dense.pth

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • test_models.patch

ONNX转换过程

Codebase准备

  • git clone

添加Patch

  • patch -R <path/to/codebase/directory>/test_models.py < test_models.patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    PYTHONPATH=. python3 test_models.py kinetics --weights=<path/to/ckpt> --test_segments=8 --test_crops=3 --batch_size=8 --dense_sample --full_res
    
  • 转换完成后,在当前目录获得tsm-r50-official-op13-fp32.onnx

3.6. ghostnet-tf-op13-fp32-N.md 导出

原始Codebase信息

  • https://github.com/huawei-noah/Efficient-AI-Backbones/tree/master/ghostnet_tensorflow

  • commit id: b8f9341cb3ada20b4e3eafea8e5e2c4fe89b2320

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • tensorflow==1.14

  • tensorpack

  • tf2onnx

ONNX转换过程

Codebase准备

  • 下载codebase

添加Patch

预训练模型准备

  • cp <path/to/codebase/directory>/models .

ONNX转换

  • onnx转换

    PYTHONPATH=<path/to/codebase/directory> python3 tensorflow2onnx.py
    mv ghostnet.onnx ghostnet-tf-op13-fp32-N.md
    
  • 转换完成后,在当前目录获得ghostnet-tf-op13-fp32-N.md

3.7. ghostnet-pt-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/huawei-noah/CV-backbones/tree/master/ghostnet_pytorch

  • commit id: 9e0b8ab4bb1cb97e1289a1870ffa8ebc35a67f0e

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py --output ghostnet-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得ghostnet-pt-op13-fp32-N.onnx

3.8. fsaf_r101_fpn_1x_coco-detection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: fsaf_r101_fpn_1x_coco-9e71098f.pth

  • config file: https://github.com/open-mmlab/mmdetection/blob/v2.25.0/configs/fsaf/fsaf_r101_fpn_1x_coco.py

  • md5:

    • fsaf_r101_fpn_1x_coco-9e71098f.pth:57eccf99477eb9f6280189a33cc90367

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fsaf_export_onnx.patch mmdetection

  • 添加patch

    • git apply fsaf_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/fsaf/fsaf_r101_fpn_1x_coco/fsaf_r101_fpn_1x_coco-9e71098f.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/fsaf/fsaf_r101_fpn_1x_coco.py ./pretrained/fsaf_r101_fpn_1x_coco-9e71098f.pth –output-file ./onnxs/fsaf_r101_fpn_1x_coco-detection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fsaf_r101_fpn_1x_coco-detection-op13-fp32-N.onnx

3.9. fsaf_r50_fpn_1x_coco-detection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/fsaf/fsaf_r50_fpn_1x_coco/fsaf_r50_fpn_1x_coco-94ccc51f.pth

  • config file: https://github.com/open-mmlab/mmdetection/blob/v2.25.0/configs/fsaf/fsaf_r50_fpn_1x_coco.py

  • md5:

    • fsaf_r50_fpn_1x_coco-94ccc51f.pth:06e400ec5179dae31e9bac255c424223

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fsaf_export_onnx.patch mmdetection

  • 添加patch

    • git apply fsaf_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/fsaf/fsaf_r50_fpn_1x_coco/fsaf_r50_fpn_1x_coco-94ccc51f.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/fsaf/fsaf_r50_fpn_1x_coco.py ./pretrained/fsaf_r50_fpn_1x_coco-94ccc51f.pth –output-file ./onnxs/fsaf_r50_fpn_1x_coco-detection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fsaf_r50_fpn_1x_coco-detection-op13-fp32-N.onnx

3.10. fsaf_x101_64x4d_fpn_1x_coco-detection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/fsaf/fsaf_x101_64x4d_fpn_1x_coco/fsaf_x101_64x4d_fpn_1x_coco-e3f6e6fd.pth

  • config file: https://github.com/open-mmlab/mmdetection/blob/v2.25.0/configs/fsaf/fsaf_x101_64x4d_fpn_1x_coco.py

  • md5:

    • fsaf_x101_64x4d_fpn_1x_coco-e3f6e6fd.pth:bdfaf67aeb562f91012a02ec8000e89e

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fsaf_export_onnx.patch mmdetection

  • 添加patch

    • git apply fsaf_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/fsaf/fsaf_x101_64x4d_fpn_1x_coco/fsaf_x101_64x4d_fpn_1x_coco-e3f6e6fd.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/fsaf/fsaf_x101_64x4d_fpn_1x_coco.py ./pretrained/fsaf_x101_64x4d_fpn_1x_coco-e3f6e6fd.pth –output-file ./onnxs/fsaf_x101_64x4d_fpn_1x_coco-detection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fsaf_x101_64x4d_fpn_1x_coco-detection-op13-fp32-N.onnx

3.11. srresnet-tf-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/tensorlayer/srgan/

  • commit id: 1d4c545cedb905e4a34dd8b05043d78d7c767786

  • branch: 1.2.1

原始预训练模型

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2pb.py

  • pb2onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • 下载ckpt

ONNX转换

  • onnx转换

    PYTHONPATH=<path/to/codebase/directory> python3 tensorflow2pb.py --input_checkpoint <path/to/ckpt> --output_graph srresnet.pb
    python3 pb2onnx.py --pb srresnet.pb --onnx srresnet-tf-op13-fp32-N.onnx --inputs input_image:0 --outputs SRGAN_g/out/Tanh:0 --opset=13
    
  • 转换完成后,在当前目录获得srresnet-tf-op13-fp32-N.onnx

3.12. srresnet-pt-op13-fp32-N.onnx

原始Codebase信息

  • https://github.com/twtygqyy/pytorch-SRResNet

  • commit id: d715729c8805f59dccd4a89acb7af11cb7b1534a

  • branch: master

原始预训练模型

  • https://github.com/twtygqyy/pytorch-SRResNet/blob/master/model/model_srresnet.pth

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    PYTHONPATH=<path/to/codebase/directory> python3 pytorch2onnx.py --model <path/to/codebase/directory>/model/model_srresnet.pth
    mv srresnet.onnx srresnet-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得srresnet-pt-op13-fp32-N.onnx

3.13. rnnt-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/mlcommons/inference

  • commit id: 8b58587c93af2a5ee67722064f2540a2db15d42f

  • branch: r1.0

原始预训练模型

ONNX转换相关的依赖

  • torch

  • toml

ONNX转换相关Patch或者代码

  • export_rnnt_to_onnx.py

ONNX转换过程

Codebase准备

git clone -b r1.0 -n https://github.com/mlcommons/inference rnnt_for_openvino --depth 1
cd rnnt_for_openvino
git checkout HEAD speech_recognition/rnnt
cd ..

添加Patch

预训练模型准备

wget https://zenodo.org/record/3662521/files/DistributedDataParallel_1576581068.9962234-epoch-100.pt

ONNX转换

  • onnx转换

python3 export_rnnt_to_onnx.py
  • 转换完成后,在当前目录获得rnnt_encoder_op13-fp32.onnx、rnnt_joint-op13-fp32.onnx、rnnt_prediction-op13-fp32.onnx

3.14. ann_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/ann/ann_r50-d8_512x1024_80k_cityscapes/ann_r50-d8_512x1024_80k_cityscapes_20200607_101911-5a9ad545.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/ann/ann_r50-d8_512x1024_80k_cityscapes.py ./pretrained/ann_r50-d8_512x1024_80k_cityscapes_20200607_101911-5a9ad545.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/ann_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/ann_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.15. fasterrcnn-resnet50_fpn_2x_pytorch-mmdetection-op13-fp32-N-topk_static.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_2x_coco/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_r50_fpn_2x_coco.py ./pretrained/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth –output-file ./onnxs/fasterrcnn-resnet50_fpn_2x_pytorch-mmdetection-op13-fp32-N-topk_static.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnet50_fpn_2x_pytorch-mmdetection-op13-fp32-N-topk_static.onnx

3.16. fasterrcnn-resnet101_fpn_3x_caffe-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r101_caffe_fpn_mstrain_3x_coco/faster_rcnn_r101_caffe_fpn_mstrain_3x_coco_20210526_095742-a7ae426d.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_r101_caffe_fpn_mstrain_3x_coco.py ./pretrained/faster_rcnn_r101_caffe_fpn_mstrain_3x_coco_20210526_095742-a7ae426d.pth –output-file ./onnxs/fasterrcnn-resnet101_fpn_3x_caffe-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnet101_fpn_3x_caffe-mmdetection-op13-fp32-N.onnx

3.17. fasterrcnn-resnet101_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r101_fpn_mstrain_3x_coco/faster_rcnn_r101_fpn_mstrain_3x_coco_20210524_110822-4d4d2ca8.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_r101_fpn_mstrain_3x_coco.py ./pretrained/faster_rcnn_r101_fpn_mstrain_3x_coco_20210524_110822-4d4d2ca8.pth –output-file ./onnxs/fasterrcnn-resnet101_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnet101_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx

3.18. fasterrcnn-resnet50_c4_1x_caffe-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_caffe_c4_mstrain_1x_coco/faster_rcnn_r50_caffe_c4_mstrain_1x_coco_20220316_150527-db276fed.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_r50_caffe_c4_mstrain_1x_coco.py ./pretrained/faster_rcnn_r50_caffe_c4_mstrain_1x_coco_20220316_150527-db276fed.pth –output-file ./onnxs/fasterrcnn-resnet50_c4_1x_caffe-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnet50_c4_1x_caffe-mmdetection-op13-fp32-N.onnx

3.19. fasterrcnn-resnet50_dc5_3x_caffe-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_caffe_dc5_mstrain_3x_coco/faster_rcnn_r50_caffe_dc5_mstrain_3x_coco_20201028_002107-34a53b2c.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_r50_caffe_dc5_mstrain_3x_coco.py ./pretrained/faster_rcnn_r50_caffe_dc5_mstrain_3x_coco_20201028_002107-34a53b2c.pth –output-file ./onnxs/fasterrcnn-resnet50_dc5_3x_caffe-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnet50_dc5_3x_caffe-mmdetection-op13-fp32-N.onnx

3.20. fasterrcnn-resnet50_fpn_2x_pytorch-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_2x_coco/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_r50_fpn_2x_coco.py ./pretrained/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth –output-file ./onnxs/fasterrcnn-resnet50_fpn_2x_pytorch-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnet50_fpn_2x_pytorch-mmdetection-op13-fp32-N.onnx

3.21. fasterrcnn-resnet50_fpn_3x_caffe-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_3x_coco/faster_rcnn_r50_caffe_fpn_mstrain_3x_coco_20210526_095054-1f77628b.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_3x_coco.py ./pretrained/faster_rcnn_r50_caffe_fpn_mstrain_3x_coco_20210526_095054-1f77628b.pth –output-file ./onnxs/fasterrcnn-resnet50_fpn_3x_caffe-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnet50_fpn_3x_caffe-mmdetection-op13-fp32-N.onnx

3.22. fasterrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_mstrain_3x_coco/faster_rcnn_r50_fpn_mstrain_3x_coco_20210524_110822-e10bd31c.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_r50_fpn_mstrain_3x_coco.py ./pretrained/faster_rcnn_r50_fpn_mstrain_3x_coco_20210524_110822-e10bd31c.pth –output-file ./onnxs/fasterrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx

3.23. fasterrcnn-resnext101_32x4d_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_x101_32x4d_fpn_mstrain_3x_coco/faster_rcnn_x101_32x4d_fpn_mstrain_3x_coco_20210524_124151-16b9b260.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_x101_32x4d_fpn_mstrain_3x_coco.py ./pretrained/faster_rcnn_x101_32x4d_fpn_mstrain_3x_coco_20210524_124151-16b9b260.pth –output-file ./onnxs/fasterrcnn-resnext101_32x4d_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnext101_32x4d_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx

3.24. fasterrcnn-resnext101_32x8d_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_x101_32x8d_fpn_mstrain_3x_coco/faster_rcnn_x101_32x8d_fpn_mstrain_3x_coco_20210604_182954-002e082a.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_x101_32x8d_fpn_mstrain_3x_coco.py ./pretrained/faster_rcnn_x101_32x8d_fpn_mstrain_3x_coco_20210604_182954-002e082a.pth –output-file ./onnxs/fasterrcnn-resnext101_32x8d_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnext101_32x8d_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx

3.25. fasterrcnn-resnext101_64x4d_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fasterrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply fasterrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_x101_64x4d_fpn_mstrain_3x_coco/faster_rcnn_x101_64x4d_fpn_mstrain_3x_coco_20210524_124528-26c63de6.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/faster_rcnn/faster_rcnn_x101_64x4d_fpn_mstrain_3x_coco.py ./pretrained/faster_rcnn_x101_64x4d_fpn_mstrain_3x_coco_20210524_124528-26c63de6.pth –output-file ./onnxs/fasterrcnn-resnext101_64x4d_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fasterrcnn-resnext101_64x4d_fpn_3x_pytorch-mmdetection-op13-fp32-N.onnx

3.26. bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv2/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes_20220808_172324-8bf0aaba.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/bisenetv2/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes.py ./pretrained/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes_20220808_172324-8bf0aaba.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.27. rosetta-mobilenet_v3-en-ppocr-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/PaddlePaddle/PaddleOCR.git

  • commit id: b1f6c210b3778c2ae32056cba2dd79675ebd14ae

原始预训练模型

  • pretrained: rec_mv3_none_none_ctc_v2.0_train.tar

  • config file: https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/configs/rec/rec_mv3_none_none_ctc.yml

  • md5:

    • rec_mv3_none_none_ctc_v2.0_train.tar:86cced2d4a5407652e2c9b20f4c5b1a4

ONNX转换相关的依赖

  • paddle2onnx==0.9.8

  • paddlepaddle==2.3.0

  • onnx==1.9.0

  • Shapely==1.8.5.post1

  • pyclipper==1.3.0.post4

  • scikit-image==0.17.2

  • imgaug==0.4.0

  • Polygon3==3.0.9.1

  • lanms==1.0.2

  • opencv-python==4.6.0.66

  • opencv-contrib-python==4.6.0.66

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/PaddlePaddle/PaddleOCR.git

    • cd PaddleOCR

  • 切换到对应分支

    • git checkout b1f6c210b3778c2ae32056cba2dd79675ebd14ae

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_none_none_ctc_v2.0_train.tar

    • tar -xvf rec_mv3_none_none_ctc_v2.0_train.tar

ONNX转换

  • inference模型转换

    • cd PaddleOCR

    • mkdir inference

    • python3 tools/export_model.py -c ./configs/rec/rec_mv3_none_none_ctc.yml -o Global.pretrained_model=./pretrained/rec_mv3_none_none_ctc_v2.0_train/best_accuracy Global.character_dict_path=./ppocr/utils/ic15_dict.txt Global.save_inference_dir=./inference

  • onnx转换

    • cd PaddleOCR

    • mkdir onnxs

    • paddle2onnx –model_dir ./inference –model_filename inference.pdmodel –params_filename inference.pdiparams –save_file ./onnxs/rosetta-mobilenet_v3-en-ppocr-op13-fp32-N.onnx –opset_version 13 –input_shape_dict=”{‘x’:[-1,3,32,100]}” –enable_onnx_checker True

    • 转换完成后,onnx模型保存在 ./onnxs/rosetta-mobilenet_v3-en-ppocr-op13-fp32-N.onnx

3.28. rosetta-resnet34-en-ppocr-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/PaddlePaddle/PaddleOCR.git

  • commit id: b1f6c210b3778c2ae32056cba2dd79675ebd14ae

原始预训练模型

  • pretrained: https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_none_ctc_v2.0_train.tar

  • config file: https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/configs/rec/rec_r34_vd_none_none_ctc.yml

  • md5:

    • rec_r34_vd_none_none_ctc_v2.0_train.tar:462a9dc3629b02f193075951d3133b0e

ONNX转换相关的依赖

  • paddle2onnx==0.9.8

  • paddlepaddle==2.3.0

  • onnx==1.9.0

  • Shapely==1.8.5.post1

  • pyclipper==1.3.0.post4

  • scikit-image==0.17.2

  • imgaug==0.4.0

  • Polygon3==3.0.9.1

  • lanms==1.0.2

  • opencv-python==4.6.0.66

  • opencv-contrib-python==4.6.0.66

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/PaddlePaddle/PaddleOCR.git

    • cd PaddleOCR

  • 切换到对应分支

    • git checkout b1f6c210b3778c2ae32056cba2dd79675ebd14ae

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_none_ctc_v2.0_train.tar

    • tar -xvf rec_r34_vd_none_none_ctc_v2.0_train.tar

ONNX转换

  • inference模型转换

    • cd PaddleOCR

    • mkdir inference

    • python3 tools/export_model.py -c ./configs/rec/rec_r34_vd_none_none_ctc.yml -o Global.pretrained_model=./pretrained/rec_r34_vd_none_none_ctc_v2.0_train/best_accuracy Global.character_dict_path=./ppocr/utils/ic15_dict.txt Global.save_inference_dir=./inference

  • onnx转换

    • cd PaddleOCR

    • mkdir onnxs

    • paddle2onnx –model_dir ./inference –model_filename inference.pdmodel –params_filename inference.pdiparams –save_file ./onnxs/rosetta-resnet34-en-ppocr-op13-fp32-N.onnx –opset_version 13 –input_shape_dict=”{‘x’:[-1,3,32,100]}” –enable_onnx_checker True

    • 转换完成后,onnx模型保存在 ./onnxs/rosetta-resnet34-en-ppocr-op13-fp32-N.onnx

3.29. roberta_large-sst2-huggingface-op13-fp32-seqN.onnx 导出

原始Codebase信息

  • https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/roberta

  • commit id: 2411f0e465e761790879e605a4256f3d4afb7f82

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • transformers

  • onnx 1.9.0

  • onnxruntime 1.10.0

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    python3 -m transformers.onnx --model=roberta-large-sst2 --opset=13 --feature='sequence-classification' onnx/
    
  • 转换完成后,在onnx目录获得roberta_large-sst2-huggingface-op13-fp32-seqN.onnx

3.30. openpose-tf-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/michalfaber/keras_Realtime_Multi-Person_Pose_Estimation

  • commit id: 0f7f5dcd8f2887a9521826dfdcf9abe56997e56a

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx_1.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

  • 下载ckpt文件

ONNX转换

  • onnx转换

    python3 tensorflow2onnx_1.py --model <path/to/ckpt>
    
  • 转换完成后,在当前目录获得openpose-tf-op13-fp32-N.onnx

3.31. openpose-cmu_640x360-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/ZheC/tf-pose-estimation

  • commit id: b5a216a6ca51767a208c226a33b1a7f38cb04295

  • branch: master

原始预训练模型

  • http://download1650.mediafire.com/35hcd7ukp3fg/n6qnqz00g1pjf7d/graph_opt.pb

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx_2.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx_2.py
    
  • 转换完成后,在当前目录获得openpose-cmu_640x360-tf-op13-fp32.onnx

3.32. openpose-cmu_640x480-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/ZheC/tf-pose-estimation

  • commit id: b5a216a6ca51767a208c226a33b1a7f38cb04295

  • branch: master

原始预训练模型

  • http://download1640.mediafire.com/vqciqfcbz7qg/eolfk6t1t3yb191/graph_opt.pb

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx_2.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx_2.py
    
  • 转换完成后,在当前目录获得openpose-cmu_640x480-tf-op13-fp32.onnx

3.33. openpose-mobilenet_thin_432x368-tf-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/ZheC/tf-pose-estimation

  • commit id: b5a216a6ca51767a208c226a33b1a7f38cb04295

  • branch: master

原始预训练模型

  • https://github.com/ZheC/tf-pose-estimation/raw/master/models/graph/mobilenet_thin_432x368/graph_opt.pb

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx_2.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx_2.py
    
  • 转换完成后,在当前目录获得openpose-mobilenet_thin_432x368-tf-op13-fp32-N.onnx

3.34. swin222_small_patch4_window7_224-ms-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/microsoft/Swin-Transformer

  • commit id: 5d2aede42b4b12cb0e7a2448b58820aeda604426

  • branch: main

原始预训练模型

  • pretrained: swin_small_patch4_window7_224.pth

  • config file: https://github.com/microsoft/Swin-Transformer/blob/main/configs/swin/swin_small_patch4_window7_224.yaml

  • md5:

    • swin_small_patch4_window7_224.pth:2019652e8942f8969395f454f78c1d29

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • timm==0.4.12

  • opencv-python==4.4.0.46

  • termcolor==1.1.0

  • yacs==0.1.8

  • pyyaml

  • scipy

ONNX转换相关Patch或相关代码

  • swin_transformer_export_onnx.patch

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/microsoft/Swin-Transformer.git

    • cd Swin-Transformer

  • 切换到对应的commit id

    • git checkout 5d2aede42b4b12cb0e7a2448b58820aeda604426

添加Patch

  • 拷贝patch到codebase目录

    • cp swin_transformer_export_onnx.patch Swin-Transoformer

  • 添加patch

    • git apply swin_transformer_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd Swin-Transformer

    • mkdir pretrained && cd pretrained

    • wget https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_small_patch4_window7_224.pth

ONNX转换

  • onnx转换

    • cd Swin-Transformer

    • mkdir onnxs

    • python3 ./onnx_export.py –cfg ./configs/swin_small_patch4_window7_224.yaml –pretrained ./pretrained/swin_small_patch4_window7_224.pth –onnx_file ./onnxs/swin_small_patch4_window7_224-ms-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/swin_small_patch4_window7_224-ms-op13-fp32-N.onnx

3.35. upernet_r50_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/upernet/upernet_r50_512x1024_80k_cityscapes/upernet_r50_512x1024_80k_cityscapes_20200607_052207-848beca8.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/upernet/upernet_r50_512x1024_80k_cityscapes.py ./pretrained/upernet_r50_512x1024_80k_cityscapes_20200607_052207-848beca8.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/upernet_r50_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/upernet_r50_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.36. apcnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/apcnet/apcnet_r50-d8_512x1024_80k_cityscapes/apcnet_r50-d8_512x1024_80k_cityscapes_20201214_115716-987f51e3.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/apcnet/apcnet_r50-d8_512x1024_80k_cityscapes.py ./pretrained/apcnet_r50-d8_512x1024_80k_cityscapes_20201214_115716-987f51e3.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/apcnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/apcnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.37. fastfcn_r50-d32_jpu_aspp_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/fastfcn/fastfcn_r50-d32_jpu_aspp_512x1024_80k_cityscapes/fastfcn_r50-d32_jpu_aspp_512x1024_80k_cityscapes_20210928_053722-5d1a2648.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/fastfcn/fastfcn_r50-d32_jpu_aspp_512x1024_80k_cityscapes.py ./pretrained/fastfcn_r50-d32_jpu_aspp_512x1024_80k_cityscapes_20210928_053722-5d1a2648.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/fastfcn_r50-d32_jpu_aspp_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/fastfcn_r50-d32_jpu_aspp_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.38. squeezenet1.0-caffe-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/forresti/SqueezeNet

  • commit id: 51147dc0681638c28aad593b9e923f3500117125

  • branch: master

原始预训练模型

  • https://github.com/forresti/SqueezeNet/tree/master/SqueezeNet_v1.0

ONNX转换相关依赖

  • coremltools==2.1.0

ONNX转换相关Patch或相关代码

  • caffe2onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 caffe2onnx.py --version 1_0
    mv squeezenet.onnx squeezenet1.0-caffe-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得squeezenet1.0-caffe-op13-fp32-N.onnx

3.39. squeezenet1.1-caffe-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/forresti/SqueezeNet

  • commit id: 51147dc0681638c28aad593b9e923f3500117125

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • coremltools==2.1.0

ONNX转换相关Patch或相关代码

  • caffe2onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 caffe2onnx.py --version 1_1
    mv squeezenet.onnx squeezenet1.1-caffe-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得squeezenet1.1-caffe-op13-fp32-N.onnx

3.40. squeezenet1.0-pt-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/pytorch/vision

  • commit id: 0ab7d05c5202e8620000566b6ea7925eae9146e1

  • branch: main

原始预训练模型

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py --version 1_0
    mv squeezenet.onnx squeezenet1.0-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得squeezenet1.0-pt-op13-fp32-N.onnx

3.41. squeezenet1.1-pt-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/pytorch/vision

  • commit id: 0ab7d05c5202e8620000566b6ea7925eae9146e1

  • branch: main

原始预训练模型

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py --version 1_1
    mv squeezenet.onnx squeezenet1.1-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得squeezenet1.1-pt-op13-fp32-N.onnx

3.42. erfnet_fcn_4x4_512x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/erfnet/erfnet_fcn_4x4_512x1024_160k_cityscapes/erfnet_fcn_4x4_512x1024_160k_cityscapes_20220704_162145-dc90157a.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/erfnet/erfnet_fcn_4x4_512x1024_160k_cityscapes.py ./pretrained/erfnet_fcn_4x4_512x1024_160k_cityscapes_20220704_162145-dc90157a.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/erfnet_fcn_4x4_512x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/erfnet_fcn_4x4_512x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.43. transformer结构拆分导出 onnx

原始Codebase信息

  • https://github.com/Ki6an/fastT5

  • commit id: 20441b33394e71f7612f39f228ecbe1925cd10ae

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • transformers>=4.17.0

  • torch==1.10.1

  • progress==1.6

ONNX转换相关Patch或相关代码

  • pt2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 pt2onnx.py
    
  • 转换完成后,在当前目录获得三个onnx transformer_encoder-mt-huggingface-op13-fp32-N.onnx transformer_decoder-mt-huggingface-op13-fp32-N.onnx transformer_init_decoder-mt-huggingface-op13-fp32-N.onnx

3.44. tsn-omnisource-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/open-mmlab/mmaction2

  • commit id: 1485998e0dfde4dc369fcf072fe74dfe79d49e32

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • mmcv-full==1.5.0

  • mmaction2==0.24.0

  • mmdet

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    python3 tools/deployment/pytorch2onnx.py configs/recognition/tsn/tsn_r50_1x1x3_100e_kinetics400_rgb.py <path/to/ckpt> --output-file tsn-omnisource-pt-op13-fp32.onnx --shape 1 3 3 320 320
    
  • 转换完成后,在当前目录获得tsn-omnisource-pt-op13-fp32.onnx

3.45. slowonly-omnisource-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/open-mmlab/mmaction2

  • commit id: 1485998e0dfde4dc369fcf072fe74dfe79d49e32

  • branch: master

原始预训练模型

  • https://download.openmmlab.com/mmaction/recognition/slowonly/omni/slowonly_r101_omni_8x8x1_kinetics400_rgb_20200926-b5dbb701.pth

ONNX转换相关依赖

  • mmcv-full==1.5.0

  • mmaction2==0.24.0

  • mmdet

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    python3 tools/deployment/pytorch2onnx.py configs/recognition/slowonly/slowonly_r101_8x8x1_196e_kinetics400_rgb.py <path/to/ckpt> --output-file slowonly-omnisource-pt-op13-fp32.onnx --shape 1 1 3 8 320 320
    
  • 转换完成后,在当前目录获得slowonly-omnisource-pt-op13-fp32.onnx

3.46. maskrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N-unexport_mask.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp maskrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply maskrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco/mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 export_onnx.py –config ./configs/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco.py –checkpoint ./pretrained/mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth –output-file ./onnxs/maskrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N-unexport_mask.onnx –opset-version 13 –input-img ./demo/demo.jpg –dynamic-export

  • 转换完成后,onnx模型保存在 ./onnxs/maskrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N-unexport_mask.onnx

3.47. maskrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N-mmcv-without_rescale.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco/mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth

  • config file: https://github.com/open-mmlab/mmdetection/tree/v2.25.0/configs/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco.py

  • md5:

    • mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth:15decf47f25fa9c7a2597c922e615f13

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp maskrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply maskrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco/mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 export_onnx.py –config ./configs/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco.py –checkpoint ./pretrained/mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth –output-file ./onnxs/maskrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N-mmcv-without_rescale.onnx –opset-version 13 –input-img ./demo/demo.jpg –dynamic-export –export-mask –use-gridsample

  • 转换完成后,onnx模型保存在 ./onnxs/maskrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N-mmcv-without_rescale.onnx

3.48. maskrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N-mmcv-with_rescale.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco/mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth

  • config file: https://github.com/open-mmlab/mmdetection/tree/v2.25.0/configs/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco.py

  • md5:

    • mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth:15decf47f25fa9c7a2597c922e615f13

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp maskrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply maskrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco/mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 export_onnx.py –config ./configs/mask_rcnn/mask_rcnn_r50_fpn_mstrain-poly_3x_coco.py –checkpoint ./pretrained/mask_rcnn_r50_fpn_mstrain-poly_3x_coco_20210524_201154-21b550bb.pth –output-file ./onnxs/maskrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N-mmcv-with_rescale.onnx –opset-version 13 –input-img ./demo/demo.jpg –dynamic-export –rescale –export-mask –use-gridsample

  • 转换完成后,onnx模型保存在 ./onnxs/maskrcnn-resnet50_fpn_3x_pytorch-mmdetection-op13-fp32-N-mmcv-with_rescale.onnx

3.49. maskrcnn-resnext101_64x4d_fpn_3x_pytorch-mmdetection-op13-fp32-N-mmcv-with_rescale.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/mask_rcnn/mask_rcnn_x101_64x4d_fpn_mstrain-poly_3x_coco/mask_rcnn_x101_64x4d_fpn_mstrain-poly_3x_coco_20210526_120447-c376f129.pth

  • config file: https://github.com/open-mmlab/mmdetection/tree/v2.25.0/configs/mask_rcnn/mask_rcnn_x101_64x4d_fpn_mstrain-poly_3x_coco.py

  • md5:

    • mask_rcnn_x101_64x4d_fpn_mstrain-poly_3x_coco_20210526_120447-c376f129.pth:d55aa1a6a9b580c934305afc989c9013

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp maskrcnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply maskrcnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/mask_rcnn/mask_rcnn_x101_64x4d_fpn_mstrain-poly_3x_coco/mask_rcnn_x101_64x4d_fpn_mstrain-poly_3x_coco_20210526_120447-c376f129.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 export_onnx.py –config ./configs/mask_rcnn/mask_rcnn_x101_64x4d_fpn_mstrain-poly_3x_coco.py –checkpoint ./pretrained/mask_rcnn_x101_64x4d_fpn_mstrain-poly_3x_coco_20210526_120447-c376f129.pth –output-file ./onnxs/maskrcnn-resnext101_64x4d_fpn_3x_pytorch-mmdetection-op13-fp32-N-mmcv-with_rescale.onnx –opset-version 13 –input-img ./demo/demo.jpg –dynamic-export –rescale –export-mask –use-gridsample

  • 转换完成后,onnx模型保存在 ./onnxs/maskrcnn-resnext101_64x4d_fpn_3x_pytorch-mmdetection-op13-fp32-N-mmcv-with_rescale.onnx

3.50. wsdan-xception-pt-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/cuihaoleo/kaggle-dfdc

  • commit id: 91dae24a31caf6a3ca273e2b5d7337b9fe6f52d5

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型

  • 从google drive下载ckpt,并且把ckpt_x.pth文件放到当前文件夹下

ONNX转换

  • onnx转换

    PYTHONPATH=<path/to/codebase/directory> python3 pytorch2onnx.py
    mv wsdan-xception.onnx wsdan-xception-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得转换完成后,在当前目录获得

3.51. dqn-super_mario_bros-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/yfeng997/MadMario

  • commit id: 6c7bfc2cfe40baae78d9a9aeb62f68d651887ea0

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • gym-super-mario-bros==7.4.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • 从google drive下载ckpt

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py --checkpoint <path/to/ckpt> --output dqn-super_mario_bros-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得dqn-super_mario_bros-op13-fp32-N.onnx

3.52. deeplabv3_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r50-d8_512x1024_80k_cityscapes/deeplabv3_r50-d8_512x1024_80k_cityscapes_20200606_113404-b92cfdd4.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/deeplabv3/deeplabv3_r50-d8_512x1024_80k_cityscapes.py ./pretrained/deeplabv3_r50-d8_512x1024_80k_cityscapes_20200606_113404-b92cfdd4.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/deeplabv3_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/deeplabv3_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.53. bert_base-squad-google-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/google-research/bert

  • commit id: eedf5716ce1268e56f0a50264a88cafad334ac61

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • tensorflow 1.15.5

  • tf2onnx

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    python3 pb2onnx.py
    
  • 转换完成后,在当前目录获得bert_base-squad-google-op13-fp32-N.onnx

3.54. bert_base-squad-nvidia-op12-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/LanguageModeling/BERT

  • commit id: 54e2fb4853ac0c393335f5187bd3b9aff4bbd765

  • branch: master

原始预训练模型

  • https://ngc.nvidia.com/catalog/models/nvidia:bert_tf_v1_1_base_fp32_384

ONNX转换相关依赖

  • tensorflow 1.15.5

  • tf2onnx

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    python3 pb2onnx.py
    
  • 转换完成后,在当前目录获得bert_base-squad-nvidia-op12-fp32-N.onnx

3.55. bert_large-squad-mlperf-op13-fp32-N.onnx 下载

原始Codebase信息

  • https://github.com/mlcommons/inference/tree/master/language/bert

  • commit id: 192f81b3d4e6b61ba48396bba2e7f3919d393e7d

  • branch: master

ONNX下载

  • https://zenodo.org/record/3733910

3.56. fcn_unet_s5-d16_4x4_512x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/unet/fcn_unet_s5-d16_4x4_512x1024_160k_cityscapes/fcn_unet_s5-d16_4x4_512x1024_160k_cityscapes_20211210_145204-6860854e.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/unet/fcn_unet_s5-d16_4x4_512x1024_160k_cityscapes.py ./pretrained/fcn_unet_s5-d16_4x4_512x1024_160k_cityscapes_20211210_145204-6860854e.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/fcn_unet_s5-d16_4x4_512x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/fcn_unet_s5-d16_4x4_512x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.57. vggface-vgg16-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/rcmalli/keras-vggface

  • commit id: bee35376e76e35d00aeec503f2f242611a97b38a

  • brach: master

原始预训练模型

ONNX转换相关依赖

  • tensorflow==1.14

  • keras==2.2.4

  • onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx_1.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx_1.py --backbone vgg --output vggface-vgg16-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得vggface-vgg16-op13-fp32-N.onnx

3.58. vggface-resnet50-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/rcmalli/keras-vggface

  • commit id: bee35376e76e35d00aeec503f2f242611a97b38a

  • brach: master

原始预训练模型

  • https://github.com/rcmalli/keras-vggface/releases/download/v2.0/rcmalli_vggface_tf_resnet50.h5

ONNX转换相关依赖

  • tensorflow==1.14

  • keras==2.2.4

  • onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx_1.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx_1.py --backbone resnet50 --output vggface-resnet50-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得vggface-resnet50-op13-fp32-N.onnx

3.59. vggface-senet50-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/rcmalli/keras-vggface

  • commit id: bee35376e76e35d00aeec503f2f242611a97b38a

  • brach: master

原始预训练模型

  • https://github.com/rcmalli/keras-vggface/releases/download/v2.0/rcmalli_vggface_tf_senet50.h5

ONNX转换相关依赖

  • tensorflow==1.14

  • keras==2.2.4

  • onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx_1.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx_1.py --backbone senet50 --output vggface-senet50-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得vggface-senet50-op13-fp32-N.onnx

3.60. vggface2-resnet50-keras-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/WeidiXie/Keras-VGGFace2-ResNet50

  • commit id: 69a608a2a140b7025bcb69adcd2355e38cc89f1d

  • branch: master

原始预训练模型

  • https://drive.google.com/file/d/1AHVpuB24lKAqNyRRjhX7ABlEor6ByZlS/view?usp=sharing

ONNX转换相关依赖

  • keras==2.4.1

ONNX转换相关Patch或相关代码

  • tensorflow2onnx_2.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

  • 下载ckpt

ONNX转换

  • onnx转换

    python3 tensorflow2onnx_2.py --ckpt <path/to/ckpt> --output vggface2-resnet50-keras-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得vggface2-resnet50-keras-op13-fp32-N.onnx

3.61. encnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp pspnet_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply pspnet_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/encnet/encnet_r50-d8_512x1024_80k_cityscapes/encnet_r50-d8_512x1024_80k_cityscapes_20200622_003554-fc5c5624.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_static-1024x2048.py ../mmsegmentation/configs/encnet/encnet_r50-d8_512x1024_80k_cityscapes.py ./pretrained/encnet_r50-d8_512x1024_80k_cityscapes_20200622_003554-fc5c5624.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/encnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/encnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx

3.62. fast_scnn_lr0-cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/fast_scnn/fast_scnn_lr0.12_8x4_160k_cityscapes/fast_scnn_lr0.12_8x4_160k_cityscapes_20210630_164853-0cec9937.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/fastscnn/fast_scnn_lr0.12_8x4_160k_cityscapes.py ./pretrained/fast_scnn_lr0.12_8x4_160k_cityscapes_20210630_164853-0cec9937.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/fast_scnn_lr0-cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/fast_scnn_lr0-cityscapes-mmsegmentation-op13-fp32-N.onnx

3.63. danet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp pspnet_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply pspnet_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/danet/danet_r50-d8_512x1024_80k_cityscapes/danet_r50-d8_512x1024_80k_cityscapes_20200607_133029-2bfa2293.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_static-1024x2048.py ../mmsegmentation/configs/danet/danet_r50-d8_512x1024_80k_cityscapes.py ./pretrained/danet_r50-d8_512x1024_80k_cityscapes_20200607_133029-2bfa2293.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/danet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/danet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.64. icnet_r50-d8_in1k-pre_832x832_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/icnet/icnet_r50-d8_in1k-pre_832x832_160k_cityscapes/icnet_r50-d8_in1k-pre_832x832_160k_cityscapes_20210926_042715-ce310aea.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/icnet/icnet_r50-d8_in1k-pre_832x832_160k_cityscapes.py ./pretrained/icnet_r50-d8_in1k-pre_832x832_160k_cityscapes_20210926_042715-ce310aea.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/icnet_r50-d8_in1k-pre_832x832_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/icnet_r50-d8_in1k-pre_832x832_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.65. bert_base-tnews-classification-op13-fp32-seqN.onnx 导出

原始Codebase信息

  • https://github.com/ChineseGLUE/ChineseGLUE/tree/master/baselines/models_pytorch/ classifier_pytorch

  • commit id: 1591b85cf5427c2ff60f718d359ecb71d2b44879

  • branch: master

原始预训练模型

  • 由客户提供ckpt (password:usXM)

ONNX转换相关依赖

  • tranformers 4.18.2

  • torch 1.10.1

  • onnxruntime 1.10.0

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    python3 -m transformers.onnx --model=/home/bert/bert_ckpt/ --opset 13  --atol 1e-5 --feature=sequence-classification
    
  • 转换完成后,在当前目录获得bert_base-tnews-classification-op13-fp32-seqN.onnx

3.66. uniformer-pt-op13-fp32-N.onnx

原始Codebase信息

  • https://github.com/Sense-X/UniFormer

  • commit id: f92e423f7360b0026b83362311a4d85e448264d7

  • branch: main

原始预训练模型

  • pytorch_model

  • https://github.com/Sense-X/UniFormer/blob/48d7dbf7ba1f637bb8929265d3db3746b524aa47/video_classification/exp/uniformer_b32x4_k400/config.yaml

ONNX转换相关依赖

  • simplejson

  • iopath

  • fvcore

  • timm

  • torch==1.10.0

  • torchvision==0.11.0

  • pytorchvideo

ONNX转换相关Patch或者相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • 从google drive下载ckpt

  • 从google drive下载config.yaml

ONNX转换

  • onnx转换

    PYTHONPATH=<path/to/codebase/directory>/video_classification python3 pytorch2onnx.py --config <path/to/config.yaml> --output uniformer-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得uniformer-pt-op13-fp32-N.onnx

3.67. deeplabv3plus_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_512x1024_80k_cityscapes/deeplabv3plus_r50-d8_512x1024_80k_cityscapes_20200606_114049-f9fb496d.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/deeplabv3plus/deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py ./pretrained/deeplabv3plus_r50-d8_512x1024_80k_cityscapes_20200606_114049-f9fb496d.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/deeplabv3plus_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/deeplabv3plus_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.68. ocrnet_hr48_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/ocrnet/ocrnet_hr48_512x1024_80k_cityscapes/ocrnet_hr48_512x1024_80k_cityscapes_20200601_222752-9076bcdf.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/ocrnet/ocrnet_hr48_512x1024_80k_cityscapes.py ./pretrained/ocrnet_hr48_512x1024_80k_cityscapes_20200601_222752-9076bcdf.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/ocrnet_hr48_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/ocrnet_hr48_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.69. cgnet_512x1024_60k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/cgnet/cgnet_512x1024_60k_cityscapes/cgnet_512x1024_60k_cityscapes_20201101_110254-124ea03b.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/cgnet/cgnet_512x1024_60k_cityscapes.py ./pretrained/cgnet_512x1024_60k_cityscapes_20201101_110254-124ea03b.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/cgnet_512x1024_60k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/cgnet_512x1024_60k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.70. mobilenet_v2-torchvision-op13-fp32-N.onnx导出

原始Codebase信息

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    • python3 pytorch2onnx.py –model mobilenet_v2 –opset 13 –dynamic-bs

  • 转换完成后,在当前目录获得mobilenet_v2-torchvision-op13-fp32-N.onnx

3.71. segformer_mit-b0_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b0_8x1_1024x1024_160k_cityscapes/segformer_mit-b0_8x1_1024x1024_160k_cityscapes_20211208_101857-e7f88502.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segformer_deploy.py ../mmsegmentation/configs/segformer/segformer_mit-b0_8x1_1024x1024_160k_cityscapes.py ./pretrained/segformer_mit-b0_8x1_1024x1024_160k_cityscapes_20211208_101857-e7f88502.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/segformer_mit-b0_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/segformer_mit-b0_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.72. segformer_mit-b1_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b1_8x1_1024x1024_160k_cityscapes/segformer_mit-b1_8x1_1024x1024_160k_cityscapes_20211208_064213-655c7b3f.pth

  • config file: https://github.com/open-mmlab/mmsegmentation/blob/v0.30.0/configs/segformer/segformer_mit-b1_8x1_1024x1024_160k_cityscapes.py

  • md5:

    • segformer_mit-b1_8x1_1024x1024_160k_cityscapes_20211208_064213-655c7b3f.pth:a476a43973e06b177da03a269fe84652

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b1_8x1_1024x1024_160k_cityscapes/segformer_mit-b1_8x1_1024x1024_160k_cityscapes_20211208_064213-655c7b3f.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segformer_deploy.py ../mmsegmentation/configs/segformer/segformer_mit-b1_8x1_1024x1024_160k_cityscapes.py ./pretrained/segformer_mit-b1_8x1_1024x1024_160k_cityscapes_20211208_064213-655c7b3f.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/segformer_mit-b1_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/segformer_mit-b1_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.73. segformer_mit-b2_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b2_8x1_1024x1024_160k_cityscapes/segformer_mit-b2_8x1_1024x1024_160k_cityscapes_20211207_134205-6096669a.pth

  • config file: https://github.com/open-mmlab/mmsegmentation/blob/v0.30.0/configs/segformer/segformer_mit-b2_8x1_1024x1024_160k_cityscapes.py

  • md5:

    • segformer_mit-b2_8x1_1024x1024_160k_cityscapes_20211207_134205-6096669a.pth:a476a43973e06b177da03a269fe84652

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b2_8x1_1024x1024_160k_cityscapes/segformer_mit-b2_8x1_1024x1024_160k_cityscapes_20211207_134205-6096669a.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segformer_deploy.py ../mmsegmentation/configs/segformer/segformer_mit-b2_8x1_1024x1024_160k_cityscapes.py ./pretrained/segformer_mit-b2_8x1_1024x1024_160k_cityscapes_20211207_134205-6096669a.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/segformer_mit-b2_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/segformer_mit-b2_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.74. segformer_mit-b3_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b3_8x1_1024x1024_160k_cityscapes/segformer_mit-b3_8x1_1024x1024_160k_cityscapes_20211206_224823-a8f8a177.pth

  • config file: https://github.com/open-mmlab/mmsegmentation/blob/v0.30.0/configs/segformer/segformer_mit-b3_8x1_1024x1024_160k_cityscapes.py

  • md5:

    • segformer_mit-b3_8x1_1024x1024_160k_cityscapes_20211206_224823-a8f8a177.pth:d86305cc72edf472800e7219d768513f

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b3_8x1_1024x1024_160k_cityscapes/segformer_mit-b3_8x1_1024x1024_160k_cityscapes_20211206_224823-a8f8a177.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segformer_deploy.py ../mmsegmentation/configs/segformer/segformer_mit-b3_8x1_1024x1024_160k_cityscapes.py ./pretrained/segformer_mit-b3_8x1_1024x1024_160k_cityscapes_20211206_224823-a8f8a177.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/segformer_mit-b3_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/segformer_mit-b3_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.75. segformer_mit-b4_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b4_8x1_1024x1024_160k_cityscapes/segformer_mit-b4_8x1_1024x1024_160k_cityscapes_20211207_080709-07f6c333.pth

  • config file: https://github.com/open-mmlab/mmsegmentation/blob/v0.30.0/configs/segformer/segformer_mit-b4_8x1_1024x1024_160k_cityscapes.py

  • md5:

    • segformer_mit-b4_8x1_1024x1024_160k_cityscapes_20211207_080709-07f6c333.pth:649550a5c5c1933765855ef331cee3f1

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b4_8x1_1024x1024_160k_cityscapes/segformer_mit-b4_8x1_1024x1024_160k_cityscapes_20211207_080709-07f6c333.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segformer_deploy.py ../mmsegmentation/configs/segformer/segformer_mit-b4_8x1_1024x1024_160k_cityscapes.py ./pretrained/segformer_mit-b4_8x1_1024x1024_160k_cityscapes_20211207_080709-07f6c333.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/segformer_mit-b4_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/segformer_mit-b4_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.76. segformer_mit-b5_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b5_8x1_1024x1024_160k_cityscapes/segformer_mit-b5_8x1_1024x1024_160k_cityscapes_20211206_072934-87a052ec.pth

  • config file: https://github.com/open-mmlab/mmsegmentation/blob/v0.30.0/configs/segformer/segformer_mit-b5_8x1_1024x1024_160k_cityscapes.py

  • md5:

    • segformer_mit-b5_8x1_1024x1024_160k_cityscapes_20211206_072934-87a052ec.pth:883163e9f9b426ecfc95ce372b0c9a05

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/segformer/segformer_mit-b5_8x1_1024x1024_160k_cityscapes/segformer_mit-b5_8x1_1024x1024_160k_cityscapes_20211206_072934-87a052ec.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segformer_deploy.py ../mmsegmentation/configs/segformer/segformer_mit-b5_8x1_1024x1024_160k_cityscapes.py ./pretrained/segformer_mit-b5_8x1_1024x1024_160k_cityscapes_20211206_072934-87a052ec.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/segformer_mit-b5_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/segformer_mit-b5_8x1_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.77. gcnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/gcnet/gcnet_r50-d8_512x1024_80k_cityscapes/gcnet_r50-d8_512x1024_80k_cityscapes_20200618_074450-ef8f069b.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/gcnet/gcnet_r50-d8_512x1024_80k_cityscapes.py ./pretrained/gcnet_r50-d8_512x1024_80k_cityscapes_20200618_074450-ef8f069b.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/gcnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/gcnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.78. retinaface-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/serengil/retinaface/tree/master

  • commit id: 878a1f6c5fa38227aa19b9881f1169b361563615

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    PYTHONPATH=<path/to/codebase/directory> python3 tensorflow2onnx.py
    
  • 转换完成后,在当前目录获得retinaface-tf-op13-fp32.onnx

3.79. retinaface-rn50-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/xxcheng0708/Pytorch_Retinaface_Accelerate

  • commit id: 8cfcd589a1e1431bbb7dc10943725f55387412a9

  • branch: master

原始预训练模型

  • https://drive.google.com/open?id=1oZRSG0ZegbVkVwUd8wUIQx8W7yfZ_ki1

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或者相关代码

  • pytorch2onnx_1.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • 从google drive下载pth文件,放到当前文件夹下的weights文件夹

ONNX转换

  • onnx转换

    PYTHONPATH=<path/to/codebase/directory> python3 pytorch2onnx.py --model resnet50
    mv retinaface.onnx retinaface-rn50-pt-op13-fp32.onnx
    
  • 转换完成后,在当前目录获得retinaface-rn50-pt-op13-fp32.onnx

3.80. retinaface-mobilenetv1-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/xxcheng0708/Pytorch_Retinaface_Accelerate

  • commit id: 8cfcd589a1e1431bbb7dc10943725f55387412a9

  • branch: master

原始预训练模型

  • https://drive.google.com/open?id=1oZRSG0ZegbVkVwUd8wUIQx8W7yfZ_ki1

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或者相关代码

  • pytorch2onnx_1.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • 从google drive下载pth文件,放到当前文件夹下的weights文件夹

ONNX转换

  • onnx转换

    PYTHONPATH=<path/to/codebase/directory> python3 pytorch2onnx.py --model mobilenet
    mv retinaface.onnx retinaface-mobilenetv1-pt-op13-fp32.onnx
    
  • 转换完成后,在当前目录获得retinaface-mobilenetv1-pt-op13-fp32.onnx

3.81. retinaface-rn50-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/biubug6/Pytorch_Retinaface

  • commit id: b984b4b775b2c4dced95c1eadd195a5c7d32a60b

  • branch: master

原始预训练模型

  • https://pan.baidu.com/s/12h97Fy1RYuqMMIV-RpzdPg

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • https://github.com/biubug6/Pytorch_Retinaface/blob/master/convert_to_onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • 下载ckpt,放到<path/to/codebase/directory>/weights文件夹下

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    python3 convert_to_onnx.py --trained_model <path/to/ckpt> --network resnet50
    mv FaceDetector.onnx retinaface-rn50-op13-fp32.onnx
    
  • 转换完成后,在当前目录获得retinaface-rn50-op13-fp32.onnx

3.82. retinaface-mbn-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/biubug6/Pytorch_Retinaface

  • commit id: b984b4b775b2c4dced95c1eadd195a5c7d32a60b

  • branch: master

原始预训练模型

  • https://pan.baidu.com/s/12h97Fy1RYuqMMIV-RpzdPg

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • https://github.com/biubug6/Pytorch_Retinaface/blob/master/convert_to_onnx.py

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • 下载ckpt,放到<path/to/codebase/directory>/weights文件夹下

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    python3 convert_to_onnx.py --trained_model <path/to/ckpt> --network mobile0.25
    mv FaceDetector.onnx retinaface-mbn-op13-fp32.onnx
    
  • 转换完成后,在当前目录获得retinaface-mbn-op13-fp32.onnx

3.83. fpn_r50_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/sem_fpn/fpn_r50_512x1024_80k_cityscapes/fpn_r50_512x1024_80k_cityscapes_20200717_021437-94018a0d.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/sem_fpn/fpn_r50_512x1024_80k_cityscapes.py ./pretrained/fpn_r50_512x1024_80k_cityscapes_20200717_021437-94018a0d.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/fpn_r50_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/fpn_r50_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.84. pspnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp pspnet_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply pspnet_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/pspnet/pspnet_r50-d8_512x1024_80k_cityscapes/pspnet_r50-d8_512x1024_80k_cityscapes_20200606_112131-2376f12b.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_static-1024x2048.py ../mmsegmentation/configs/pspnet/pspnet_r50-d8_512x1024_80k_cityscapes.py ./pretrained/pspnet_r50-d8_512x1024_80k_cityscapes_20200606_112131-2376f12b.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/pspnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/pspnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx

3.85. wavenet-tf-op13-fp32.onnx导出

原始Codebase信息

  • https://github.com/ibab/tensorflow-wavenet.git

  • commit id: 3c973c038c8c2c20fef0039f111cb04139ff594b

  • branch: master

原始预训练模型

ONNX转换相关的依赖

  • tensorflow

  • tf2onnx

ONNX转换相关Patch或相关代码

  • wavenet_export_onnx.patch

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/ibab/tensorflow-wavenet.git

    • cd tensorflow-wavenet

  • 切换到对应的commit id

    • git checkout 3c973c038c8c2c20fef0039f111cb04139ff594b

添加Patch

  • 拷贝patch到codebase目录

    • cp wavenet_export_onnx.patch tensorflow-wavenet

  • 添加patch

    • git apply wavenet_export_onnx.patch

预训练模型准备

  • 模型训练

    • python3 train.py –data_dir=VCTK-Corpus/ –silence_threshold=0.1(在logdir下获取checkpoint文件)

ONNX转换

  • onnx转换

    • ckpt2pb

      python3 onnx_export/ckpt2pb.py \
          --ckpt_path=./logdir/your/checkpoint \
          --pb_path=onnx_export/ \
          --pb_name=wavenet.pb \
          --input_names=wavenet_1/Slice \
          --output_names=wavenet_1/postprocessing/Add_51
      其中参数`--ckpt_path`传入训练好的checkpoint,如`./logdir/final_ckpt/model.ckpt-99999`
      
    • pb2onnx

      python3 -m tf2onnx.convert \
          --input=onnx_export/wavenet.pb\
          --output=onnx_export/wavenet-tf-op13-fp32.onnx\
          --opset 13 \
          --verbose \
          --inputs=wavenet_1/Slice:0[1,5117,256] \
          --outputs=wavenet_1/postprocessing/Add_51:0
      
    • 转换完成后,onnx模型保存在 ./onnx_export/wavenet-tf-op13-fp32.onnx

3.86. isanet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/isanet/isanet_r50-d8_512x1024_80k_cityscapes/isanet_r50-d8_512x1024_80k_cityscapes_20210901_074202-89384497.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/isanet/isanet_r50-d8_512x1024_80k_cityscapes.py ./pretrained/isanet_r50-d8_512x1024_80k_cityscapes_20210901_074202-89384497.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/isanet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/isanet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.87. videomae-pt-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/huggingface/transformers

  • commit id: 4d10de55b4a2a35031cd876b9e3f894b3f96ef1e

  • branch: main

原始预训练模型

ONNX转换相关依赖

  • transformers

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py --output videomae-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得videomae-pt-op13-fp32-N.onnx

3.88. ernie_3.0_base_ch-classification-opset13-fp32-seqN.onnx 导出

原始Codebase信息

  • https://github.com/PaddlePaddle/ERNIE

  • commit id: ce2c2637aca5d398937028fb0cc457efea8833ab

  • branch: master

原始预训练模型

  • codebase中下载,执行sh download_ernie_3.0_base_ch.sh

ONNX转换相关依赖

  • paddle2onnx

  • paddlepaddle >= 2.2

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

      paddle2onnx --model_dir ERNIE/applications/tasks/text_classification/output/cls_ernie_3.0_base_fc_ch_dy/save_inference_model/inference_step_251 \
                  --model_filename ERNIE/onnx_model/wenxin.pdmodel \
                  --params_filename ERNIE/onnx_model/wenxin.pdiparams \
                  --save_file test_wenxin_model.onnx \
                  --opset_version 13 \
                  --enable_dev_version True \
                  --enable_onnx_checker True \
    
  • 转换完成后,在当前目录获得ernie_3.0_base_ch-classification-opset13-fp32-seqN.onnx

3.89. retinanet-rn50_640-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/tensorflow/models/blob/master/official/vision/beta/modeling/retinanet_model.py

  • commit id: 987238e67bc9f5126b67fc5032ebe31b1368a5b6

  • branch: r2

原始预训练模型

ONNX转换相关依赖

  • tf2onnx

ONNX转换相关Patch或者相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx.py --model rn50_640
    
  • 转换完成后,在当前目录获得retinanet-rn50_640-tf-op13-fp32.onnx

3.90. retinanet-rn50_1024-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/tensorflow/models/blob/master/official/vision/beta/modeling/retinanet_model.py

  • commit id: 987238e67bc9f5126b67fc5032ebe31b1368a5b6

  • branch: r2

原始预训练模型

ONNX转换相关依赖

  • tf2onnx

ONNX转换相关Patch或者相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx.py --model rn50_1024
    
  • 转换完成后,在当前目录获得retinanet-rn50_1024-tf-op13-fp32.onnx

3.91. retinanet-rn101_640-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/tensorflow/models/blob/master/official/vision/beta/modeling/retinanet_model.py

  • commit id: 987238e67bc9f5126b67fc5032ebe31b1368a5b6

  • branch: r2

原始预训练模型

ONNX转换相关依赖

  • tf2onnx

ONNX转换相关Patch或者相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx.py --model rn101_640
    
  • 转换完成后,在当前目录获得retinanet-rn101_640-tf-op13-fp32.onnx

3.92. retinanet-rn101_1024-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/tensorflow/models/blob/master/official/vision/beta/modeling/retinanet_model.py

  • commit id: 987238e67bc9f5126b67fc5032ebe31b1368a5b6

  • branch: r2

原始预训练模型

ONNX转换相关依赖

  • tf2onnx

ONNX转换相关Patch或者相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx.py --model rn101_1024
    
  • 转换完成后,在当前目录获得retinanet-rn101_1024-tf-op13-fp32.onnx

3.93. retinanet-rn152_640-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/tensorflow/models/blob/master/official/vision/beta/modeling/retinanet_model.py

  • commit id: 987238e67bc9f5126b67fc5032ebe31b1368a5b6

  • branch: r2

原始预训练模型

ONNX转换相关依赖

  • tf2onnx

ONNX转换相关Patch或者相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx.py --model rn152_640
    
  • 转换完成后,在当前目录获得retinanet-rn152_640-tf-op13-fp32.onnx

3.94. retinanet-rn152_1024-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/tensorflow/models/blob/master/official/vision/beta/modeling/retinanet_model.py

  • commit id: 987238e67bc9f5126b67fc5032ebe31b1368a5b6

  • branch: r2

原始预训练模型

ONNX转换相关依赖

  • tf2onnx

ONNX转换相关Patch或者相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2onnx.py --model rn152_1024
    
  • 转换完成后,在当前目录获得retinanet-rn152_1024-tf-op13-fp32.onnx

3.95. retinanet-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/pytorch/vision/blob/main/torchvision/models/detection/retinanet.py

  • commit id: 291f7e20339510cfa956b5782741697eb8e6d554

  • branch: v0.8.0

原始预训练模型

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

  • retinanet.patch

ONNX转换过程

Codebase准备

  • git clone

  • cd <path/to/codebase/directory>

  • git checkout v0.8.0

添加Patch

  • cp <path/to/codebase/directory>/torchvision/models/detection/retinanet.py .

  • patch retinanet.py < retinanet.patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py
    mv retinanet.onnx retinanet-pt-op13-fp32.onnx
    
  • 转换完成后,在当前目录获得retinanet-pt-op13-fp32.onnx

3.96. retinanet-r50-mmdet-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection/tree/master/configs/retinanet

  • commit id: 08f77b597d4bcd1a436681d7274edc1b6f9bddb3

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.5.0

  • mmdet==2.24.1

ONNX转换相关Patch或相关代码

  • mmdet2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 mmdet2onnx.py
    
  • 转换完成后,在当前目录获得retinanet-r50-mmdet-pt-op13-fp32.onnx

3.97. retinanet-r101-mmdet-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection/tree/master/configs/retinanet

  • commit id: 08f77b597d4bcd1a436681d7274edc1b6f9bddb3

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.5.0

  • mmdet==2.24.1

ONNX转换相关Patch或相关代码

  • mmdet2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 mmdet2onnx.py
    
  • 转换完成后,在当前目录获得retinanet-r101-mmdet-pt-op13-fp32.onnx

3.98. gpt2-chinese-general-1024-kvcache-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/Morizeyao/GPT2-Chinese

  • commit id: bbb44651be8361faef35d2a857451d231b5ebe14

  • branch: old_gpt_2_chinese_before_2021_4_22

原始预训练模型

ONNX转换相关依赖

  • transformers

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

  • 从baidu cloud disk下载ckpt

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py --ckpt <path/to/ckpt> --opset 13 --output gpt2-chinese-general-1024-kvcache-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得gpt2-chinese-general-1024-kvcache-op13-fp32-N.onnx

3.99. facenet-inceptionv1-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/davidsandberg/facenet

  • commit id: 096ed770f163957c1e56efa7feeb194773920f6e

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

  • 从google drive 下载预训练模型

ONNX转换

  • onnx转换

    python3 tensorflow2onnx.py --pb <path/to/pb/file> --output facenet-inceptionv1-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得facenet-inceptionv1-op13-fp32-N.onnx

3.100. facenet-vggface-op13-fp32-N.onnx 转换

原始Codebase信息

  • https://github.com/davidsandberg/facenet

  • commit id: 096ed770f163957c1e56efa7feeb194773920f6e

  • branch: master

原始预训练模型

  • https://drive.google.com/open?id=1EXPBSXwTaqrSC0OhUdXNmKSh9qJUQ55-

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

  • 从google drive 下载预训练模型

ONNX转换

  • onnx转换

    python3 tensorflow2onnx.py --pb <path/to/pb/file> --output facenet-vggface-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得facenet-vggface-op13-fp32-N.onnx

3.101. fcos_resnet50_fpn_1x_caffe-detection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: fcos_r50_caffe_fpn_gn-head_1x_coco-821213aa.pth

  • config file: https://github.com/open-mmlab/mmdetection/blob/v2.25.0/fcos/fcos_r50_caffe_fpn_gn-head_1x_coco.py

  • md5:

    • fcos_r50_caffe_fpn_gn-head_1x_coco-821213aa.pth:54406d018a161bb2844dc9db4736ceaa

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcos_export_onnx.patch mmdetection

  • 添加patch

    • git apply fcos_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_r50_caffe_fpn_gn-head_1x_coco/fcos_r50_caffe_fpn_gn-head_1x_coco-821213aa.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/fcos/fcos_r50_caffe_fpn_gn-head_1x_coco.py ./pretrained/fcos_r50_caffe_fpn_gn-head_1x_coco-821213aa.pth –output-file ./onnxs/fcos_resnet50_fpn_1x_caffe-detection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fcos_resnet50_fpn_1x_caffe-detection-op13-fp32-N.onnx

3.102. fcos_resnet50_fpn_mstrain_2x_caffe-detection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_r50_caffe_fpn_gn-head_mstrain_640-800_2x_coco/fcos_r50_caffe_fpn_gn-head_mstrain_640-800_2x_coco-d92ceeea.pth

  • config file: https://github.com/open-mmlab/mmdetection/blob/v2.25.0/fcos/fcos_r50_caffe_fpn_gn-head_mstrain_640-800_2x_coco.py

  • md5:

    • fcos_r50_caffe_fpn_gn-head_mstrain_640-800_2x_coco-d92ceeea.pth:70e14e9be43356023063d638829ed850

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcos_export_onnx.patch mmdetection

  • 添加patch

    • git apply fcos_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_r50_caffe_fpn_gn-head_mstrain_640-800_2x_coco/fcos_r50_caffe_fpn_gn-head_mstrain_640-800_2x_coco-d92ceeea.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/fcos/fcos_r50_caffe_fpn_gn-head_mstrain_640-800_2x_coco.py ./pretrained/fcos_r50_caffe_fpn_gn-head_mstrain_640-800_2x_coco-d92ceeea.pth –output-file ./onnxs/fcos_resnet50_fpn_mstrain_2x_caffe-detection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fcos_resnet50_fpn_mstrain_2x_caffe-detection-op13-fp32-N.onnx

3.103. fcos_resnet50_fpn_tricks_1x_caffe-detection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_1x_coco/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_1x_coco-0a0d75a8.pth

  • config file: https://github.com/open-mmlab/mmdetection/blob/v2.25.0/fcos/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_1x_coco.py

  • md5:

    • fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_1x_coco-0a0d75a8.pth:bbda238427ee9f352581afb7b8cf522b

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcos_export_onnx.patch mmdetection

  • 添加patch

    • git apply fcos_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_1x_coco/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_1x_coco-0a0d75a8.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/fcos/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_1x_coco.py ./pretrained/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_1x_coco-0a0d75a8.pth –output-file ./onnxs/fcos_resnet50_fpn_tricks_1x_caffe-detection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fcos_resnet50_fpn_tricks_1x_caffe-detection-op13-fp32-N.onnx

3.104. fcos_resnet101_fpn_1x_caffe-detection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_r101_caffe_fpn_gn-head_1x_coco/fcos_r101_caffe_fpn_gn-head_1x_coco-0e37b982.pth

  • config file: https://github.com/open-mmlab/mmdetection/blob/v2.25.0/fcos/fcos_r101_caffe_fpn_gn-head_1x_coco.py

  • md5:

    • fcos_r101_caffe_fpn_gn-head_1x_coco-0e37b982.pth:67795b037007d49ef5e7267caed1c77d

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcos_export_onnx.patch mmdetection

  • 添加patch

    • git apply fcos_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_r101_caffe_fpn_gn-head_1x_coco/fcos_r101_caffe_fpn_gn-head_1x_coco-0e37b982.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/fcos/fcos_r101_caffe_fpn_gn-head_1x_coco.py ./pretrained/fcos_r101_caffe_fpn_gn-head_1x_coco-0e37b982.pth –output-file ./onnxs/fcos_resnet101_fpn_1x_caffe-detection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fcos_resnet101_fpn_1x_caffe-detection-op13-fp32-N.onnx

3.105. fcos_resnet101_fpn_mstrain_2x_caffe-detection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco-511424d6.pth

  • config file: https://github.com/open-mmlab/mmdetection/blob/v2.25.0/fcos/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco.py

  • md5:

    • fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco-511424d6.pth:67795b037007d49ef5e7267caed1c77d

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcos_export_onnx.patch mmdetection

  • 添加patch

    • git apply fcos_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco-511424d6.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/fcos/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco.py ./pretrained/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco-511424d6.pth –output-file ./onnxs/fcos_resnet101_fpn_mstrain_2x_caffe-detection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fcos_resnet101_fpn_mstrain_2x_caffe-detection-op13-fp32-N.onnx

3.106. fcos_resnext101_fpn_mstrain_2x_caffe-detection-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_x101_64x4d_fpn_gn-head_mstrain_640-800_2x_coco/fcos_x101_64x4d_fpn_gn-head_mstrain_640-800_2x_coco-ede514a8.pth

  • config file: https://github.com/open-mmlab/mmdetection/blob/v2.25.0/fcos/fcos_x101_64x4d_fpn_gn-head_mstrain_640-800_2x_coco.py

  • md5:

    • fcos_x101_64x4d_fpn_gn-head_mstrain_640-800_2x_coco-ede514a8.pth:f5addf49a02795e1facc458ec20d6ecd

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcos_export_onnx.patch mmdetection

  • 添加patch

    • git apply fcos_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/fcos/fcos_x101_64x4d_fpn_gn-head_mstrain_640-800_2x_coco/fcos_x101_64x4d_fpn_gn-head_mstrain_640-800_2x_coco-ede514a8.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 tools/deployment/pytorch2onnx.py ./configs/fcos/fcos_x101_64x4d_fpn_gn-head_mstrain_640-800_2x_coco.py ./pretrained/fcos_x101_64x4d_fpn_gn-head_mstrain_640-800_2x_coco-ede514a8.pth –output-file ./onnxs/fcos_resnext101_fpn_mstrain_2x_caffe-detection-op13-fp32-N.onnx –input-img ./demo/demo.jpg –opset-version 13 –dynamic-export

    • 转换完成后,onnx模型保存在 ./onnxs/fcos_resnext101_fpn_mstrain_2x_caffe-detection-op13-fp32-N.onnx

3.107. deeplabv3-mobilenetv2-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/tensorflow/models/tree/master/research/deeplab

  • commit id: 532b946c6c2efefc88ab58e3a0a590758e2287cf

  • branch: main

原始预训练模型

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2pb.py

  • pb2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2pb.py --save_model --model mobilenetv2_coco_voctrainaug
    mv deeplab.pb deeplabv3-mobilenetv2.pb
    python3 pb2onnx.py --pb_path=deeplabv3-mobilenetv2.pb --onnx_path=deeplabv3-mobilenetv2-tf-op13-fp32.onnx --inputs ImageTensor:0 --outputs SemanticPredictions:0 --opset=13
    
  • 转换完成后,在当前目录获得deeplabv3-mobilenetv2-tf-op13-fp32.onnx

3.108. deeplabv3-xception-tf-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/tensorflow/models/tree/master/research/deeplab

  • commit id: 532b946c6c2efefc88ab58e3a0a590758e2287cf

  • branch: main

原始预训练模型

  • http://download.tensorflow.org/models/deeplabv3_mnv2_pascal_train_aug_2018_01_29.tar.gz

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

ONNX转换相关Patch或相关代码

  • tensorflow2pb.py

  • pb2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 tensorflow2pb.py --save_model --model xception_coco_voctrainaug
    mv deeplab.pb deeplabv3-xception.pb
    python3 pb2onnx.py --pb_path=deeplabv3-xception.pb --onnx_path=deeplabv3-xception-tf-op13-fp32.onnx --inputs ImageTensor:0 --outputs SemanticPredictions:0 --opset=13
    
  • 转换完成后,在当前目录获得deeplabv3-xception-tf-op13-fp32.onnx

3.109. deeplabv3-mobilenetv3-pt-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/pytorch/vision/blob/main/torchvision/models/segmentation/deeplabv3.py

  • commit id: 50d54a82d1479ffb6dd7469ed05fccdf290a1d84

  • branch: master

原始预训练模型

  • https://download.pytorch.org/models/deeplabv3_mobilenet_v3_large-fc3c493d.pth

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py --model deeplabv3_mobilenet_v3_large
    mv deeplabv3.onnx deeplabv3-mobilenetv3-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得deeplabv3-mobilenetv3-pt-op13-fp32-N.onnx

3.110. deeplabv3-resnet50-pt-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/pytorch/vision/blob/main/torchvision/models/segmentation/deeplabv3.py

  • commit id: 50d54a82d1479ffb6dd7469ed05fccdf290a1d84

  • branch: master

原始预训练模型

  • https://download.pytorch.org/models/deeplabv3_resnet50_coco-cd0a2569.pth

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py --model deeplabv3_resnet50
    mv deeplabv3.onnx deeplabv3-resnet50-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得deeplabv3-resnet50-pt-op13-fp32-N.onnx

3.111. deeplabv3-resnet101-pt-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/pytorch/vision/blob/main/torchvision/models/segmentation/deeplabv3.py

  • commit id: 50d54a82d1479ffb6dd7469ed05fccdf290a1d84

  • branch: master

原始预训练模型

  • https://download.pytorch.org/models/deeplabv3_resnet101_coco-586e9e4e.pth

ONNX转换相关依赖

  • torch==1.10.0

  • torchvision==0.11.0

ONNX转换相关Patch或相关代码

  • pytorch2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

ONNX转换

  • onnx转换

    python3 pytorch2onnx.py --model deeplabv3_resnet101
    mv deeplabv3.onnx deeplabv3-resnet101-pt-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得deeplabv3-resnet101-pt-op13-fp32-N.onnx

3.112. dmnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp pspnet_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply pspnet_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/dmnet/dmnet_r50-d8_512x1024_80k_cityscapes/dmnet_r50-d8_512x1024_80k_cityscapes_20201215_053728-3c8893b9.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_static-1024x2048.py ../mmsegmentation/configs/dmnet/dmnet_r50-d8_512x1024_80k_cityscapes.py ./pretrained/dmnet_r50-d8_512x1024_80k_cityscapes_20201215_053728-3c8893b9.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/dmnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/dmnet_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32.onnx

3.113. minigo-op13-fp32-N.onnx 导出

原始Codebase信息

  • https://github.com/tensorflow/minigo

  • commit id: 6d89c202cdceaf449aefc3149ab2110d44f1a6a4

  • branch: master

原始预训练模型

  • gs://minigo-pub/v9-19x19/models/000737-fury.*

ONNX转换相关依赖

  • tensorflow==1.14

  • tf2onnx

  • google-cloud-sdk

ONNX转换相关Patch或相关代码

  • tensorflow2onnx.py

ONNX转换过程

Codebase准备

添加Patch

预训练模型准备

  • bash download_ckpt.sh

ONNX转换

  • onnx转换

    python3 tensorflow2onnx.py --ckpt models/000737-fury.pb --output minigo-op13-fp32-N.onnx
    
  • 转换完成后,在当前目录获得minigo-op13-fp32-N.onnx

3.114. bisenetv1_r50-d32_in1k-pre_4x4_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/bisenetv1/bisenetv1_r50-d32_in1k-pre_4x4_1024x1024_160k_cityscapes/bisenetv1_r50-d32_in1k-pre_4x4_1024x1024_160k_cityscapes_20210917_234628-8b304447.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/bisenetv1/bisenetv1_r50-d32_in1k-pre_4x4_1024x1024_160k_cityscapes.py ./pretrained/bisenetv1_r50-d32_in1k-pre_4x4_1024x1024_160k_cityscapes_20210917_234628-8b304447.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/bisenetv1_r50-d32_in1k-pre_4x4_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/bisenetv1_r50-d32_in1k-pre_4x4_1024x1024_160k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.115. timesformer-divst-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/open-mmlab/mmaction2

  • commit id: 1485998e0dfde4dc369fcf072fe74dfe79d49e32

  • branch: master

原始预训练模型

ONNX转换相关依赖

  • mmcv-full==1.5.0

  • mmaction2==0.24.0

  • mmdet

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    python3 tools/deployment/pytorch2onnx.py configs/recognition/timesformer/timesformer_divST_8x32x1_15e_kinetics400_rgb.py <path/to/ckpt> --output-file timesformer_divst.onnx --shape 1 1 3 8 224 224
    
  • 转换完成后,在当前目录获得timesformer-divst-pt-op13-fp32.onnx

3.116. timesformer-jointst-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/open-mmlab/mmaction2

  • commit id: 1485998e0dfde4dc369fcf072fe74dfe79d49e32

  • branch: master

原始预训练模型

  • https://download.openmmlab.com/mmaction/recognition/timesformer/timesformer_jointST_8x32x1_15e_kinetics400_rgb/timesformer_jointST_8x32x1_15e_kinetics400_rgb-0d6e3984.pth

ONNX转换相关依赖

  • mmcv-full==1.5.0

  • mmaction2==0.24.0

  • mmdet

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    python3 tools/deployment/pytorch2onnx.py configs/recognition/timesformer/timesformer_jointST_8x32x1_15e_kinetics400_rgb.py <path/to/ckpt> --output-file timesformer_jointst.onnx --shape 1 1 3 8 224 224
    
  • 转换完成后,在当前目录获得timesformer-jointst-pt-op13-fp32.onnx

3.117. timesformer-spaceonly-pt-op13-fp32.onnx 导出

原始Codebase信息

  • https://github.com/open-mmlab/mmaction2

  • commit id: 1485998e0dfde4dc369fcf072fe74dfe79d49e32

  • branch: master

原始预训练模型

  • wget https://download.openmmlab.com/mmaction/recognition/timesformer/timesformer_spaceOnly_8x32x1_15e_kinetics400_rgb/timesformer_spaceOnly_8x32x1_15e_kinetics400_rgb-0cf829cd.pth

ONNX转换相关依赖

  • mmcv-full==1.5.0

  • mmaction2==0.24.0

  • mmdet

ONNX转换相关Patch或相关代码

ONNX转换过程

Codebase准备

  • git clone

添加Patch

预训练模型准备

  • wget

ONNX转换

  • onnx转换

    cd <path/to/codebase/directory>
    python3 tools/deployment/pytorch2onnx.py configs/recognition/timesformer/timesformer_spaceOnly_8x32x1_15e_kinetics400_rgb.py <path/to/ckpt> --output-file timesformer_spaceonly.onnx --shape 1 1 3 8 224 224
    
  • 转换完成后,在当前目录获得timesformer-spaceonly-pt-op13-fp32.onnx

3.118. setr_vit-large_naive_8x1_768x768_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/setr/setr_naive_vit-large_8x1_768x768_80k_cityscapes/setr_naive_vit-large_8x1_768x768_80k_cityscapes_20211123_000505-20728e80.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/setr_deploy.py ../mmsegmentation/configs/setr/setr_vit-large_naive_8x1_768x768_80k_cityscapes.py ./pretrained/setr_naive_vit-large_8x1_768x768_80k_cityscapes_20211123_000505-20728e80.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/setr_vit-large_naive_8x1_768x768_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/setr_vit-large_naive_8x1_768x768_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.119. cascade_mask_rcnn-resnet50_fpn_pytorch_3x-mmdetection-op13-fp32-N-unexport_mask-topk_static.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp cascadercnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply cascadercnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_mask_rcnn_r50_fpn_mstrain_3x_coco/cascade_mask_rcnn_r50_fpn_mstrain_3x_coco_20210628_164719-5bdc3824.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 export_onnx.py –config ./configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_mstrain_3x_coco.py –checkpoint ./pretrained/cascade_mask_rcnn_r50_fpn_mstrain_3x_coco_20210628_164719-5bdc3824.pth –output-file ./onnxs/cascade_mask_rcnn-resnet50_fpn_pytorch_3x-mmdetection-op13-fp32-N-unexport_mask-topk_static.onnx –opset-version 13 –input-img ./demo/demo.jpg –dynamic-export

  • 转换完成后,onnx模型保存在 ./onnxs/cascade_mask_rcnn-resnet50_fpn_pytorch_3x-mmdetection-op13-fp32-N-unexport_mask-topk_static.onnx

3.120. cascade_rcnn-resnet50_fpn_pytorch_20e-mmdetection-op13-fp32-N-topk_static.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_rcnn_r50_fpn_20e_coco/cascade_rcnn_r50_fpn_20e_coco_bbox_mAP-0.41_20200504_175131-e9872a90.pth

  • config file: https://github.com/open-mmlab/mmdetection/tree/master/configs/cascade_rcnn/cascade_rcnn_r50_fpn_20e_coco.py

  • md5:

    • cascade_mask_rcnn_r50_fpn_mstrain_3x_coco_20210628_164719-5bdc3824.pth:48b09b357b00f5d8b0a8d20db6da3732

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp cascadercnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply cascadercnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_rcnn_r50_fpn_20e_coco/cascade_rcnn_r50_fpn_20e_coco_bbox_mAP-0.41_20200504_175131-e9872a90.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 export_onnx.py –config ./configs/cascade_rcnn/cascade_rcnn_r50_fpn_20e_coco.py –checkpoint ./pretrained/cascade_rcnn_r50_fpn_20e_coco_bbox_mAP-0.41_20200504_175131-e9872a90.pth –output-file ./onnxs/cascade_rcnn-resnet50_fpn_pytorch_20e-mmdetection-op13-fp32-N-topk_static.onnx –opset-version 13 –input-img ./demo/demo.jpg –dynamic-export

  • 转换完成后,onnx模型保存在 ./onnxs/cascade_rcnn-resnet50_fpn_pytorch_20e-mmdetection-op13-fp32-N-topk_static.onnx

3.121. cascade_rcnn-resnet101_fpn_pytorch_20e-mmdetection-op13-fp32-N-topk_static.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_rcnn_r101_fpn_20e_coco/cascade_rcnn_r101_fpn_20e_coco_bbox_mAP-0.425_20200504_231812-5057dcc5.pth

  • config file: https://github.com/open-mmlab/mmdetection/tree/master/configs/cascade_rcnn/cascade_rcnn_r101_fpn_20e_coco.py

  • md5:

    • cascade_rcnn_r101_fpn_20e_coco_bbox_mAP-0.425_20200504_231812-5057dcc5.pth:9ccb9ff0450d9bb428014f89de21ca39

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp cascadercnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply cascadercnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_rcnn_r101_fpn_20e_coco/cascade_rcnn_r101_fpn_20e_coco_bbox_mAP-0.425_20200504_231812-5057dcc5.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 export_onnx.py –config ./configs/cascade_rcnn/cascade_rcnn_r101_fpn_20e_coco.py –checkpoint ./pretrained/cascade_rcnn_r101_fpn_20e_coco_bbox_mAP-0.425_20200504_231812-5057dcc5.pth –output-file ./onnxs/cascade_rcnn-resnet101_fpn_pytorch_20e-mmdetection-op13-fp32-N-topk_static.onnx –opset-version 13 –input-img ./demo/demo.jpg –dynamic-export

  • 转换完成后,onnx模型保存在 ./onnxs/cascade_rcnn-resnet101_fpn_pytorch_20e-mmdetection-op13-fp32-N-topk_static.onnx

3.122. cascade_rcnn-resnext101_32x4d_fpn_20e-mmdetection-op13-fp32-N-topk_static.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_rcnn_x101_32x4d_fpn_20e_coco/cascade_rcnn_x101_32x4d_fpn_20e_coco_20200906_134608-9ae0a720.pth

  • config file: https://github.com/open-mmlab/mmdetection/tree/master/configs/cascade_rcnn/cascade_rcnn_x101_32x4d_fpn_20e_coco.py

  • md5:

    • cascade_rcnn_x101_32x4d_fpn_20e_coco_20200906_134608-9ae0a720.pth:c9772ee9fcd20b41e44d53dd58094503

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp cascadercnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply cascadercnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_rcnn_x101_32x4d_fpn_20e_coco/cascade_rcnn_x101_32x4d_fpn_20e_coco_20200906_134608-9ae0a720.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 export_onnx.py –config ./configs/cascade_rcnn/cascade_rcnn_x101_32x4d_fpn_20e_coco.py –checkpoint ./pretrained/cascade_rcnn_x101_32x4d_fpn_20e_coco_20200906_134608-9ae0a720.pth –output-file ./onnxs/cascade_rcnn-resnext101_32x4d_fpn_20e-mmdetection-op13-fp32-N-topk_static.onnx –opset-version 13 –input-img ./demo/demo.jpg –dynamic-export

  • 转换完成后,onnx模型保存在 ./onnxs/cascade_rcnn-resnext101_32x4d_fpn_20e-mmdetection-op13-fp32-N-topk_static.onnx

3.123. cascade_rcnn-resnext101_64x4d_fpn_20e-mmdetection-op13-fp32-N-topk_static.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmdetection

  • commit id: ca11860f4f3c3ca2ce8340e2686eeaec05b29111

  • tags: v2.25.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_rcnn_x101_64x4d_fpn_20e_coco/cascade_rcnn_x101_64x4d_fpn_20e_coco_20200509_224357-051557b1.pth

  • config file: https://github.com/open-mmlab/mmdetection/tree/master/configs/cascade_rcnn/cascade_rcnn_x101_64x4d_fpn_20e_coco.py

  • md5:

    • cascade_rcnn_x101_32x4d_fpn_20e_coco_20200906_134608-9ae0a720.pth:079710605bd6f6a01648b6d0d8ebd805

ONNX转换相关的依赖

  • torch==1.10.0

  • torchvision==0.11.0

  • mmcv-full==1.4.0

  • mmdet==2.25.0

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/open-mmlab/mmdetection.git

    • cd mmdetection

  • 切换到对应分支

    • git checkout v2.25.0

添加Patch

  • 拷贝patch到codebase目录

    • cp cascadercnn_export_onnx.patch mmdetection

  • 添加patch

    • git apply cascadercnn_export_onnx.patch

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_rcnn_x101_64x4d_fpn_20e_coco/cascade_rcnn_x101_64x4d_fpn_20e_coco_20200509_224357-051557b1.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • python3 export_onnx.py –config ./configs/cascade_rcnn/cascade_rcnn_x101_64x4d_fpn_20e_coco.py –checkpoint ./pretrained/cascade_rcnn_x101_64x4d_fpn_20e_coco_20200509_224357-051557b1.pth –output-file ./onnxs/cascade_rcnn-resnext101_64x4d_fpn_20e-mmdetection-op13-fp32-N-topk_static.onnx –opset-version 13 –input-img ./demo/demo.jpg –dynamic-export

  • 转换完成后,onnx模型保存在 ./onnxs/cascade_rcnn-resnext101_64x4d_fpn_20e-mmdetection-op13-fp32-N-topk_static.onnx

3.124. fcn-resnet50-d8-512x1024-80k-cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_r50-d8_512x1024_80k_cityscapes/fcn_r50-d8_512x1024_80k_cityscapes_20200606_113019-03aa804d.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/fcn/fcn_r50-d8_512x1024_80k_cityscapes.py ./pretrained/fcn_r50-d8_512x1024_80k_cityscapes_20200606_113019-03aa804d.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/fcn-resnet50-d8-512x1024-80k-cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/fcn-resnet50-d8-512x1024-80k-cityscapes-mmsegmentation-op13-fp32-N.onnx

3.125. fcn-d6-resnet50-d16-512x1024-40k-cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_512x1024_40k_cityscapes/fcn_d6_r50-d16_512x1024_40k_cityscapes_20210305_130133-98d5d1bc.pth

  • config file: https://github.com/open-mmlab/mmsegmentation/blob/v0.30.0/configs/fcn/fcn_d6_r50-d16_512x1024_40k_cityscapes.py

  • md5:

    • fcn_d6_r50-d16_512x1024_40k_cityscapes_20210305_130133-98d5d1bc.pth:e8eacd1308d398c137480e3d7a54d2e9

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r50-d16_512x1024_40k_cityscapes/fcn_d6_r50-d16_512x1024_40k_cityscapes_20210305_130133-98d5d1bc.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/fcn/fcn_d6_r50-d16_512x1024_40k_cityscapes.py ./pretrained/fcn_d6_r50-d16_512x1024_40k_cityscapes_20210305_130133-98d5d1bc.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/fcn-d6-resnet50-d16-512x1024-40k-cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/fcn-d6-resnet50-d16-512x1024-40k-cityscapes-mmsegmentation-op13-fp32-N.onnx

3.126. fcn-resnet101-d8-512x1024-80k-cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_r101-d8_512x1024_80k_cityscapes/fcn_r101-d8_512x1024_80k_cityscapes_20200606_113038-3fb937eb.pth

  • config file: https://github.com/open-mmlab/mmsegmentation/blob/v0.30.0/configs/fcn/fcn_r101-d8_512x1024_80k_cityscapes.py

  • md5:

    • fcn_r101-d8_512x1024_80k_cityscapes_20200606_113038-3fb937eb.pth:74717647f0e31c37be5faaa17d4ec34e

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_r101-d8_512x1024_80k_cityscapes/fcn_r101-d8_512x1024_80k_cityscapes_20200606_113038-3fb937eb.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/fcn/fcn_r101-d8_512x1024_80k_cityscapes.py ./pretrained/fcn_r101-d8_512x1024_80k_cityscapes_20200606_113038-3fb937eb.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/fcn-resnet101-d8-512x1024-80k-cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/fcn-resnet101-d8-512x1024-80k-cityscapes-mmsegmentation-op13-fp32-N.onnx

3.127. fcn-d6-resnet101-d16-512x1024-40k-cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_512x1024_40k_cityscapes/fcn_d6_r101-d16_512x1024_40k_cityscapes_20210305_130337-9cf2b450.pth

  • config file: https://github.com/open-mmlab/mmsegmentation/blob/v0.30.0/configs/fcn/fcn_d6_r101-d16_512x1024_40k_cityscapes.py

  • md5:

    • fcn_d6_r101-d16_512x1024_40k_cityscapes_20210305_130337-9cf2b450.pth:dbf7158e9ff381ab47a08495d2f5e94d

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/fcn/fcn_d6_r101-d16_512x1024_40k_cityscapes/fcn_d6_r101-d16_512x1024_40k_cityscapes_20210305_130337-9cf2b450.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/fcn/fcn_d6_r101-d16_512x1024_40k_cityscapes.py ./pretrained/fcn_d6_r101-d16_512x1024_40k_cityscapes_20210305_130337-9cf2b450.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/fcn-d6-resnet101-d16-512x1024-40k-cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/fcn-d6-resnet101-d16-512x1024-40k-cityscapes-mmsegmentation-op13-fp32-N.onnx

3.128. stdc1_in1k-pre_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/stdc/stdc1_in1k-pre_512x1024_80k_cityscapes/stdc1_in1k-pre_512x1024_80k_cityscapes_20220224_141648-3d4c2981.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/stdc/stdc1_in1k-pre_512x1024_80k_cityscapes.py ./pretrained/stdc1_in1k-pre_512x1024_80k_cityscapes_20220224_141648-3d4c2981.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/stdc1_in1k-pre_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/stdc1_in1k-pre_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.129. stdc2_in1k-pre_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

  • pretrained: https://download.openmmlab.com/mmsegmentation/v0.5/stdc/stdc2_in1k-pre_512x1024_80k_cityscapes/stdc2_in1k-pre_512x1024_80k_cityscapes_20220224_073048-1f8f0f6c.pth

  • config file: https://github.com/open-mmlab/mmsegmentation/blob/v0.30.0/configs/stdc/stdc2_in1k-pre_512x1024_80k_cityscapes.py

  • md5:

    • stdc2_in1k-pre_512x1024_80k_cityscapes_20220224_073048-1f8f0f6c.pth:4c5055e8888f3af2a7ea471dd4d68c0f

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp fcn_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply fcn_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/stdc/stdc2_in1k-pre_512x1024_80k_cityscapes/stdc2_in1k-pre_512x1024_80k_cityscapes_20220224_073048-1f8f0f6c.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_dynamic.py ../mmsegmentation/configs/stdc/stdc2_in1k-pre_512x1024_80k_cityscapes.py ./pretrained/stdc2_in1k-pre_512x1024_80k_cityscapes_20220224_073048-1f8f0f6c.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/stdc2_in1k-pre_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/stdc2_in1k-pre_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.130. nonlocal_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/open-mmlab/mmsegmentation

  • commit id: ed839828760a5f6193822e0bf3492b88ae6140da

  • tags: v0.30.0

原始预训练模型

ONNX转换相关的依赖

  • torch==1.12.0

  • torchvision==0.13.0

  • mmcv-full==1.6.0

  • mmsegmentation==0.30.0

  • onnx==1.9.0

  • onnxruntime==1.9.0

ONNX转换过程

Codebase准备

  • 拉取mmsegmentation代码

    • git clone https://github.com/open-mmlab/mmsegmentation.git

    • cd mmdetection

    • git checkout v0.30.0

  • 拉取mmdeploy代码

    • https://github.com/open-mmlab/mmdeploy.git

    • cd mmdeploy

    • git chekout v0.12.0

添加Patch

  • 拷贝patch到codebase目录

    • cp pspnet_export_onnx.patch mmdeploy

  • 添加patch

    • cd mmdeploy

    • git apply pspnet_export_onnx.patch

    • python setup.py install

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://download.openmmlab.com/mmsegmentation/v0.5/nonlocal_net/nonlocal_r50-d8_512x1024_80k_cityscapes/nonlocal_r50-d8_512x1024_80k_cityscapes_20200607_193518-d6839fae.pth

ONNX转换

  • onnx转换

    • cd mmdetection

    • mkdir onnxs

    • export ONNX_BACKEND=MMCVTensorRT

    • python3 ./tools/deploy.py ./configs/mmseg/segmentation_onnxruntime_static-1024x2048.py ../mmsegmentation/configs/nonlocal_net/nonlocal_r50-d8_512x1024_80k_cityscapes.py ./pretrained/nonlocal_r50-d8_512x1024_80k_cityscapes_20200607_193518-d6839fae.pth ../mmsegmentation/demo/demo.png –test-img ../mmsegmentation/demo/demo.png –work-dir ./onnxs

    • mv ./onnxs/end2end.onnx ./onnxs/nonlocal_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

  • 转换完成后,onnx模型保存在 ./onnxs/nonlocal_r50-d8_512x1024_80k_cityscapes-mmsegmentation-op13-fp32-N.onnx

3.131. crnn-mobilenet_v3-en-ppocr-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/PaddlePaddle/PaddleOCR.git

  • commit id: b1f6c210b3778c2ae32056cba2dd79675ebd14ae

原始预训练模型

  • pretrained: rec_mv3_none_bilstm_ctc_v2.0_train.tar

  • config file: https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/configs/rec/rec_mv3_none_bilstm_ctc.yml

  • md5:

    • rec_mv3_none_bilstm_ctc_v2.0_train.tar:0bb7ddf89ad996e89ad5cfb7689c93d4

ONNX转换相关的依赖

  • paddle2onnx==0.9.8

  • paddlepaddle==2.3.0

  • onnx==1.9.0

  • Shapely==1.8.5.post1

  • pyclipper==1.3.0.post4

  • scikit-image==0.17.2

  • imgaug==0.4.0

  • Polygon3==3.0.9.1

  • lanms==1.0.2

  • opencv-python==4.6.0.66

  • opencv-contrib-python==4.6.0.66

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/PaddlePaddle/PaddleOCR.git

    • cd PaddleOCR

  • 切换到对应分支

    • git checkout b1f6c210b3778c2ae32056cba2dd79675ebd14ae

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_none_bilstm_ctc_v2.0_train.tar

    • tar -xvf rec_mv3_none_bilstm_ctc_v2.0_train.tar

ONNX转换

  • inference模型转换

    • cd PaddleOCR

    • mkdir inference

    • python3 tools/export_model.py -c ./configs/rec/rec_mv3_none_bilstm_ctc.yml -o Global.pretrained_model=./pretrained/rec_mv3_none_bilstm_ctc_v2.0_train/best_accuracy Global.character_dict_path=./ppocr/utils/ic15_dict.txt Global.save_inference_dir=./inference

  • onnx转换

    • cd PaddleOCR

    • mkdir onnxs

    • paddle2onnx –model_dir ./inference –model_filename inference.pdmodel –params_filename inference.pdiparams –save_file ./onnxs/crnn-mobilenet_v3-en-ppocr-op13-fp32-N.onnx –opset_version 13 –input_shape_dict=”{‘x’:[-1,3,32,100]}” –enable_onnx_checker True

    • 转换完成后,onnx模型保存在 ./onnxs/crnn-mobilenet_v3-en-ppocr-op13-fp32-N.onnx

3.132. crnn-resnet34-en-ppocr-op13-fp32-N.onnx导出

原始Codebase信息

  • https://github.com/PaddlePaddle/PaddleOCR.git

  • commit id: b1f6c210b3778c2ae32056cba2dd79675ebd14ae

原始预训练模型

  • pretrained: https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_bilstm_ctc_v2.0_train.tar

  • config file: https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/configs/rec/rec_r34_vd_none_bilstm_ctc.yml

  • md5:

    • rec_r34_vd_none_bilstm_ctc_v2.0_train.tar:53a4eba08d31942524391c83438843b8

ONNX转换相关的依赖

  • paddle2onnx==0.9.8

  • paddlepaddle==2.3.0

  • onnx==1.9.0

  • Shapely==1.8.5.post1

  • pyclipper==1.3.0.post4

  • scikit-image==0.17.2

  • imgaug==0.4.0

  • Polygon3==3.0.9.1

  • lanms==1.0.2

  • opencv-python==4.6.0.66

  • opencv-contrib-python==4.6.0.66

ONNX转换过程

Codebase准备

  • 拉取代码

    • git clone https://github.com/PaddlePaddle/PaddleOCR.git

    • cd PaddleOCR

  • 切换到对应分支

    • git checkout b1f6c210b3778c2ae32056cba2dd79675ebd14ae

预训练模型准备

  • 下载预训练模型

    • cd mmdetection

    • mkdir pretrained && cd pretrained

    • wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_bilstm_ctc_v2.0_train.tar

    • tar -xvf rec_r34_vd_none_bilstm_ctc_v2.0_train.tar

ONNX转换

  • inference模型转换

    • cd PaddleOCR

    • mkdir inference

    • python3 tools/export_model.py -c ./configs/rec/rec_r34_vd_none_bilstm_ctc.yml -o Global.pretrained_model=./pretrained/rec_r34_vd_none_bilstm_ctc_v2.0_train/best_accuracy Global.character_dict_path=./ppocr/utils/ic15_dict.txt Global.save_inference_dir=./inference

  • onnx转换

    • cd PaddleOCR

    • mkdir onnxs

    • paddle2onnx –model_dir ./inference –model_filename inference.pdmodel –params_filename inference.pdiparams –save_file ./onnxs/crnn-resnet34-en-ppocr-op13-fp32-N.onnx –opset_version 13 –input_shape_dict=”{‘x’:[-1,3,32,100]}” –enable_onnx_checker True

    • 转换完成后,onnx模型保存在 ./onnxs/crnn-resnet34-en-ppocr-op13-fp32-N.onnx