mmdetection-to-tensorrt 使用教程

mmdetection-to-tensorrt 使用教程

mmdetection-to-tensorrt项目地址:https://gitcode.com/gh_mirrors/mm/mmdetection-to-tensorrt

项目介绍

mmdetection-to-tensorrt 是一个开源项目,旨在支持将 MMDetection 模型通过 TensorRT 进行端到端部署。该项目跳过了通常的 pth -> onnx -> tensorrt 的转换步骤,直接从 pth 文件转换成 TensorRT 模型,支持多种模型和模块,如 Faster R-CNN、Cascade R-CNN 等。

项目快速启动

环境配置

  1. 安装 MMDetection:

    pip install openmim
    mim install mmdet==3.3.0
    
  2. 安装 torch2trt_dynamic:

    git clone https://github.com/grimoire/torch2trt_dynamic
    cd torch2trt_dynamic
    pip install -e .
    
  3. 安装 amirstan_plugin:

    git clone --depth=1 https://github.com/grimoire/amirstan_plugin
    cd amirstan_plugin
    git submodule update --init --progress --depth=1
    mkdir build && cd build
    cmake .. && make
    

模型转换

  1. 克隆项目:

    git clone https://github.com/grimoire/mmdetection-to-tensorrt.git
    cd mmdetection-to-tensorrt
    
  2. 运行转换脚本:

    python demo/inference.py --img <测试图像路径> --config <mmdetection 的模型配置文件> --checkpoint <模型 pth 文件路径> --save_path <tensorrt 模型存放路径> --score-thr <检测有效阈值>
    

应用案例和最佳实践

案例一:实时物体检测

使用 mmdetection-to-tensorrt 将训练好的 MMDetection 模型转换为 TensorRT 模型,部署在边缘设备上进行实时物体检测。通过优化后的模型,可以显著提高检测速度和准确性。

案例二:多模态融合

结合不同传感器数据,使用 mmdetection-to-tensorrt 支持的模型进行多模态融合,提高复杂场景下的物体检测和分割性能。

典型生态项目

MMDetection

MMDetection 是一个基于 PyTorch 的目标检测工具箱,提供了丰富的模型和训练策略,是 mmdetection-to-tensorrt 的基础项目。

TensorRT

TensorRT 是 NVIDIA 推出的高性能深度学习推理引擎,支持多种优化技术,如 fp16、int8 和动态输入形状,与 mmdetection-to-tensorrt 结合使用可以进一步提升模型性能。

通过以上步骤和案例,您可以快速上手并应用 mmdetection-to-tensorrt 项目,实现高效的模型部署和推理。

mmdetection-to-tensorrt项目地址:https://gitcode.com/gh_mirrors/mm/mmdetection-to-tensorrt

  • 8
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

薛美婵

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值