[Docs] Improve Chinese and English build.md (#191)

* Improve build.md

* Improve chinese build.md

* Imporve Chinese doc, using 您 when translate 'you'

* Update build.md, change pip install cmd
pull/217/head
HinGwenWoong 2022-03-07 17:19:03 +08:00 committed by GitHub
parent 34879e638c
commit 8a43621ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 72 deletions

View File

@ -97,7 +97,7 @@ MMDeploy 是一个开源深度学习模型部署工具箱,它是 [OpenMMLab](h
## 引用
如果在研究中使用了本项目的代码或者性能基准,请参考如下 bibtex 引用 MMDeploy:
如果在研究中使用了本项目的代码或者性能基准,请参考如下 bibtex 引用 MMDeploy:
```BibTeX
@misc{=mmdeploy,
@ -148,4 +148,4 @@ MMDeploy 是一个开源深度学习模型部署工具箱,它是 [OpenMMLab](h
- 🏃 获取更高效的问题答疑和意见反馈
- 🔥 提供与各行各业开发者充分交流的平台
干货满满 📘,等来撩 💗OpenMMLab 社区期待您的加入 👬
干货满满 📘,等来撩 💗OpenMMLab 社区期待您的加入 👬

View File

@ -10,6 +10,7 @@ We provide building methods for both physical and virtual machines. For virtual
```bash
git clone -b master git@github.com:open-mmlab/mmdeploy.git MMDeploy
cd MMDeploy
export MMDEPLOY_DIR=$(pwd)
git submodule update --init --recursive
```
@ -49,7 +50,7 @@ We provide building methods for both physical and virtual machines. For virtual
```bash
# Add repository if ubuntu < 18.04
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
# Install
sudo apt-get install gcc-7
sudo apt-get install g++-7
```
@ -105,7 +106,7 @@ Valid keys for the extras field are: `all`, `tests`, `build`, `optional`.
### Build SDK
Readers can skip this chapter if you are only interested in model converter.
You can skip this chapter if you are only interested in model converter.
#### Dependencies
@ -156,7 +157,6 @@ Each package's installation command is given based on Ubuntu 18.04.
`-DMMDEPLOY_BUILD_SDK=ON`
- Enabling Devices
By default, only CPU device is included in the target devices. You can enable device support for other devices by
@ -179,13 +179,13 @@ Each package's installation command is given based on Ubuntu 18.04.
e.g. `-DMMDEPLOY_TARGET_BACKENDS="trt;ort;pplnn;ncnn;openvino"`
A path to the inference engine library is also needed. The following backends are currently supported
| library | name | path setter |
|-------------|----------|-----------------|
| PPL.nn | pplnn | pplnn_DIR |
| ncnn | ncnn | ncnn_DIR |
| ONNXRuntime | ort | ONNXRUNTIME_DIR |
| library | name | path setter |
|-------------|----------|--------------------------|
| PPL.nn | pplnn | pplnn_DIR |
| ncnn | ncnn | ncnn_DIR |
| ONNXRuntime | ort | ONNXRUNTIME_DIR |
| TensorRT | trt | TENSORRT_DIR & CUDNN_DIR |
| OpenVINO | openvino | InferenceEngine_DIR |
| OpenVINO | openvino | InferenceEngine_DIR |
- Enabling codebase's postprocess components

View File

@ -34,7 +34,7 @@
要求 cmake>=3.14.0, 通过如下指令安装 cmake。您也通过 [cmake](https://cmake.org/install) 官网查看更多安装信息。
```bash
apt-get install -y libssl-dev
sudo apt-get install -y libssl-dev
wget https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0.tar.gz
tar -zxvf cmake-3.20.0.tar.gz
cd cmake-3.20.0
@ -48,8 +48,9 @@
MMDeploy SDK 使用了 C++17 特性因此需要安装gcc 7+以上的版本。
```bash
# Add repository if ubuntu < 18.04
# 如果 Ubuntu 版本 < 18.04
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
# 安装
sudo apt-get install gcc-7
sudo apt-get install g++-7
```
@ -98,15 +99,15 @@ pip install -e .
**Note**
- 有些依赖项是可选的。运行 `pip install -e .` 将进行最小化依赖安装。 如果需安装其他可选依赖项,请执行`pip install -r requirements/optional.txt`
或者 `pip install -e . [optional]`。其中,`[optional]`可以填写`all`, `tests`, `build`, `optional`
或者 `pip install -e . [optional]`。其中,`[optional]`可以替换为:`all`、`tests`、`build` 或 `optional`
### 构建 SDK
读者如果只对模型转换感兴趣,那么可以跳过本章节
如果只对模型转换感兴趣,那么可以跳过本章节
#### 安装依赖项
目前SDK在Linux-x86_64经过测试验证未来将加入对更多平台的支持。 使用SDK需要安装若干依赖包。本文以 Ubuntu 18.04为例,逐一介绍各依赖项的安装方法
目前SDK在Linux-x86_64经过测试验证未来将加入对更多平台的支持。 使用SDK需要安装若干依赖包。本章节以 Ubuntu 18.04 为例,逐一介绍各依赖项的安装方法。
- OpenCV 3+
@ -127,7 +128,7 @@ pip install -e .
sudo dpkg -i libspdlog-dev_0.16.3-1_amd64.deb
```
你也可以使用spdlog源码编译,激活它更多的特性。但是,请务必打开 **`-fPIC`** 编译选项。
您也可以使用spdlog的源码进行编译,激活它更多的特性。但是,请务必打开 **`-fPIC`** 编译选项。
- pplcv
@ -142,7 +143,7 @@ pip install -e .
```
- 推理引擎
SDK 和 model converter 使用相同的推理引擎。 请参考前文中”安装推理引擎“章节,选择合适的进行安装.
SDK 和 model converter 使用相同的推理引擎。 请参考前文中[安装推理引擎](#安装推理引擎)章节,以此来选择合适的引擎进行安装.
#### 设置编译选项
@ -152,26 +153,26 @@ pip install -e .
- 设置目标设备
cpu 是 SDK 目标设备的默认选项。也可以通过`MMDEPLOY_TARGET_DEVICES`传入其他设备名称。当有多个设备时,设备名称之间使用分号隔开。
cpu 是 SDK 目标设备的默认选项。也可以通过`MMDEPLOY_TARGET_DEVICES`传入其他设备名称。当有多个设备时,设备名称之间使用分号隔开。
比如,`-DMMDEPLOY_TARGET_DEVICES="cpu;cuda"`。
当前SDK支持以下设备
当前SDK支持以下设备
| 设备 | 名称 | 查找路径 |
| :--- | :--- | :--------------------------------- |
| Host | cpu | N/A |
| CUDA | cuda | CUDA_TOOLKIT_ROOT_DIR 和 pplcv_DIR |
如果的开发环境中有多个cuda版本则需要通过`-DCUDA_TOOLKIT_ROOT_DIR=/path/of/cuda`来明确使用的版本。
如果的开发环境中有多个cuda版本则需要通过`-DCUDA_TOOLKIT_ROOT_DIR=/path/of/cuda`来明确使用的版本。
于此同时,还需设置`-Dpplcv_DIR=ppl.cv/path/install/lib/cmake/ppl`用以编译cuda平台下的图像处理算子。
- 设置推理后端
**默认情况下SDK不设置任何后端**, 因为它与应用场景高度相关。可以通过设置`MMDEPLOY_TARGET_BACKENDS`激活感兴趣的推理后端。
当选择多个时, 中间使用分号隔开。比如`-DMMDEPLOY_TARGET_BACKENDS="trt;ort;pplnn;ncnn;openvino"`
**默认情况下SDK不设置任何后端**, 因为它与应用场景高度相关。可以通过设置`MMDEPLOY_TARGET_BACKENDS`激活感兴趣的推理后端。
当选择多个时, 中间使用分号隔开。比如`-DMMDEPLOY_TARGET_BACKENDS="trt;ort;pplnn;ncnn;openvino"`
构建时,几乎每个后端,都需设置一些环境变量,用来查找依赖包。
下表展示了目前SDK支持的后端以及构建时每个后端需要设置的变量
下表展示了目前SDK支持的后端以及构建时每个后端需要设置的变量
| 推理引擎 | 名称 | 查找路径 |
| 推理引擎 | 名称 | 查找路径 |
| :---------- | :------- | :----------------------- |
| PPL.nn | pplnn | pplnn_DIR |
| ncnn | ncnn | ncnn_DIR |
@ -187,32 +188,33 @@ pip install -e .
- 汇总以上
下文展示2个构建SDK的样例分别用于不同的运行环境。
使用cpu设备和ONNXRuntime推理请参考
```Bash
mkdir build && cd build
cmake .. \
- 使用cpu设备和ONNXRuntime推理请参考
```Bash
mkdir build && cd build
cmake .. \
-DMMDEPLOY_BUILD_SDK=ON \
-DCMAKE_CXX_COMPILER=g++-7 \
-DONNXRUNTIME_DIR=/path/to/onnxruntime \
-DMMDEPLOY_TARGET_DEVICES=cpu \
-DMMDEPLOY_TARGET_BACKENDS=ort \
-DMMDEPLOY_CODEBASES=all
cmake --build . -- -j$(nproc) && cmake --install .
```
- 使用cuda设备和TensorRT推理请按照此例构建
```Bash
mkdir build && cd build
cmake .. \
-DMMDEPLOY_BUILD_SDK=ON \
-DCMAKE_CXX_COMPILER=g++-7 \
-DONNXRUNTIME_DIR=/path/to/onnxruntime \
-DMMDEPLOY_TARGET_DEVICES=cpu \
-DMMDEPLOY_TARGET_BACKENDS=ort \
-Dpplcv_DIR=/path/to/ppl.cv/cuda-build/install/lib/cmake/ppl \
-DTENSORRT_DIR=/path/to/tensorrt \
-DCUDNN_DIR=/path/to/cudnn \
-DMMDEPLOY_TARGET_DEVICES="cuda;cpu" \
-DMMDEPLOY_TARGET_BACKENDS=trt \
-DMMDEPLOY_CODEBASES=all
cmake --build . -- -j$(nproc) && cmake --install .
```
使用cuda设备和TensorRT推理请按照此例构建
```Bash
mkdir build && cd build
cmake .. \
-DMMDEPLOY_BUILD_SDK=ON \
-DCMAKE_CXX_COMPILER=g++-7 \
-Dpplcv_DIR=/path/to/ppl.cv/cuda-build/install/lib/cmake/ppl \
-DTENSORRT_DIR=/path/to/tensorrt \
-DCUDNN_DIR=/path/to/cudnn \
-DMMDEPLOY_TARGET_DEVICES="cuda;cpu" \
-DMMDEPLOY_TARGET_BACKENDS=trt \
-DMMDEPLOY_CODEBASES=all
cmake --build . -- -j$(nproc) && cmake --install .
```
cmake --build . -- -j$(nproc) && cmake --install .
```

View File

@ -1,26 +1,26 @@
## 快速上手
MMDeploy提供了一系列工具帮助你更轻松的将OpenMMLab下的算法部署到各种设备与平台上。你可以使用我们设计的流程一“部”到位也可以定制你自己的转换流程。这份指引将会向你展示MMDeploy的基本使用方式并帮助你将 MMDeploy SDK 整合进你的应用。
MMDeploy提供了一系列工具帮助您更轻松的将OpenMMLab下的算法部署到各种设备与平台上。您可以使用我们设计的流程一“部”到位也可以定制您自己的转换流程。这份指引将会向您展示MMDeploy的基本使用方式并帮助您将 MMDeploy SDK 整合进您的应用。
### 准备工作
首先我们需要根据[安装指南](./build.md)正确安装MMDeploy。**注意!** 不同推理后端的安装方式略有不同。可以根据下面的介绍选择最适合的推理后端:
首先我们需要根据[安装指南](./build.md)正确安装MMDeploy。**注意!** 不同推理后端的安装方式略有不同。可以根据下面的介绍选择最适合的推理后端:
- [ONNXRuntime](https://mmdeploy.readthedocs.io/en/latest/backends/onnxruntime.html): ONNX Runtime 是一个跨平台的机器学习训练推理加速器,通过图形优化和变换以及硬件加速器提供优秀的推理性能。<span style="color:red">拥有完善的对ONNX的支持</span>
- [TensorRT](https://mmdeploy.readthedocs.io/en/latest/backends/tensorrt.html): NVIDIA® TensorRT™ 是一个用于高性能深度学习推理的开发工具包SDK。借助Nvidia的设备特性TensorRT可以优化模型的推理提供更低的推理延迟以及更高的吞吐量。如果希望将模型部署在<span style="color:red">NVIDIA硬件设备</span>那么TensorRT就是一个合适的选择。
- [ncnn](https://mmdeploy.readthedocs.io/en/latest/backends/ncnn.html): ncnn 是一个<span style="color:red">为手机端极致优化</span>的高性能神经网络前向计算框架。ncnn 从设计之初深刻考虑手机端的部署和使用。无第三方依赖,跨平台。基于 ncnn开发者能够将深度学习算法轻松移植到手机端高效执行开发出人工智能 APP将 AI 带到的指尖。
- [TensorRT](https://mmdeploy.readthedocs.io/en/latest/backends/tensorrt.html): NVIDIA® TensorRT™ 是一个用于高性能深度学习推理的开发工具包SDK。借助Nvidia的设备特性TensorRT可以优化模型的推理提供更低的推理延迟以及更高的吞吐量。如果希望将模型部署在<span style="color:red">NVIDIA硬件设备</span>那么TensorRT就是一个合适的选择。
- [ncnn](https://mmdeploy.readthedocs.io/en/latest/backends/ncnn.html): ncnn 是一个<span style="color:red">为手机端极致优化</span>的高性能神经网络前向计算框架。ncnn 从设计之初深刻考虑手机端的部署和使用。无第三方依赖,跨平台。基于 ncnn开发者能够将深度学习算法轻松移植到手机端高效执行开发出人工智能 APP将 AI 带到的指尖。
- [PPLNN](https://mmdeploy.readthedocs.io/en/latest/backends/pplnn.html): PPLNN是一个为高效AI推理所开发的高性能深度学习推理引擎。可以用于各种ONNX模型的推理。并且<span style="color:red">对OpenMMLab有非常强的支持</span>
- [OpenVINO](https://mmdeploy.readthedocs.io/en/latest/backends/openvino.html): OpenVINO™ 是一个为优化与部署AI推理开发的开源工具集。该工具集<span style="color:red">可无缝集成到 Intel 硬件平台</span>包括最新的神经网络加速芯片Intel计算棒边缘设备等。
选择最适合的推理后端,点击对应的连接查看具体安装细节
选择最适合的推理后端,点击对应的连接查看具体安装细节
### 模型转换
一旦完成了MMDeploy的安装就可以用一条指令轻松的将OpenMMLab的PyTorch模型转换成推理后端支持的格式以 [MMDetection](https://github.com/open-mmlab/mmdetection) 中的 `Faster-RCNN``TensorRT` 的转换为例:
一旦完成了MMDeploy的安装就可以用一条指令轻松的将OpenMMLab的PyTorch模型转换成推理后端支持的格式以 [MMDetection](https://github.com/open-mmlab/mmdetection) 中的 `Faster-RCNN``TensorRT` 的转换为例:
```bash
# 本例假设 MMDeploy 所在目录为 ${MMDEPLOY_DIR} MMDetection 所在目录为 ${MMDET_DIR}
# 如果不知道具体的安装位置,可以在终端通过命令 `pip show mmdeploy``pip show mmdet` 查看
# 如果不知道具体的安装位置,可以在终端通过命令 `pip show mmdeploy``pip show mmdet` 查看
python ${MMDEPLOY_DIR}/tools/deploy.py \
${MMDEPLOY_DIR}/configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py \
@ -40,11 +40,11 @@ python ${MMDEPLOY_DIR}/tools/deploy.py \
<任务名>_<推理后端>-[后端特性]_<动态模型支持>.py
```
可以很容易的通过文件名来确定最适合的那个配置文件。如果希望定制自己的转换配置,可以修改配置文件中的具体条目。我们提供了 [如何编写配置文件](https://mmdeploy.readthedocs.io/en/latest/tutorials/how_to_write_config.html) 来指导如何进行编辑。
可以很容易的通过文件名来确定最适合的那个配置文件。如果希望定制自己的转换配置,可以修改配置文件中的具体条目。我们提供了 [如何编写配置文件](https://mmdeploy.readthedocs.io/en/latest/tutorials/how_to_write_config.html) 来指导如何进行编辑。
### 模型推理
得到了转换后的模型之后就可以使用推理后端提供的API来进行推理。也许想绕过API的学习与开发确认下转换后的模型效果。我们提供了对这些API的统一封装
得到了转换后的模型之后就可以使用推理后端提供的API来进行推理。也许想绕过API的学习与开发确认下转换后的模型效果。我们提供了对这些API的统一封装
```python
from mmdeploy.apis import inference_model
@ -115,7 +115,7 @@ pip install -v -e .
#### 下载 Faster R-CNN 的模型文件
请从[本链接](https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth)下载模型文件,放在`{MMDET_ROOT}/checkpoints`目录下。其中`{MMDET_ROOT}`为的MMDetection的根目录。
请从[本链接](https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth)下载模型文件,放在`{MMDET_ROOT}/checkpoints`目录下。其中`{MMDET_ROOT}`为的MMDetection的根目录。
#### 安装 MMDeploy 以及 ONNX Runtime
@ -170,7 +170,7 @@ make -j$(nproc) && make install
```bash
# 本例假设 MMDeploy 所在目录为 ${MMDEPLOY_DIR} MMDetection 所在目录为 ${MMDET_DIR}
# 如果不知道具体的安装位置,可以在终端通过命令 `pip show mmdeploy``pip show mmdet` 查看
# 如果不知道具体的安装位置,可以在终端通过命令 `pip show mmdeploy``pip show mmdet` 查看
python ${MMDEPLOY_DIR}/tools/deploy.py \
${MMDEPLOY_DIR}/configs/mmdet/detection/detection_onnxruntime_dynamic.py \
@ -209,7 +209,7 @@ export SPDLOG_LEVEL=warn
### 新模型的支持?
如果你希望使用的模型尚未被 MMDeploy 所支持,你可以尝试自己添加对应的支持。我们准备了如下的文档:
如果您希望使用的模型尚未被 MMDeploy 所支持,您可以尝试自己添加对应的支持。我们准备了如下的文档:
- 请阅读[如何支持新模型](https://mmdeploy.readthedocs.io/en/latest/tutorials/how_to_support_new_models.html)了解我们的模型重写机制。
最后欢迎大家踊跃提PR。

View File

@ -27,8 +27,8 @@
#### 准备工作
1. 安装你的目标后端。 你可以参考 [ONNXRuntime-install](https://mmdeploy.readthedocs.io/en/latest/backends/onnxruntime.html) [TensorRT-install](https://mmdeploy.readthedocs.io/en/latest/backends/tensorrt.html) [NCNN-install](https://mmdeploy.readthedocs.io/en/latest/backends/ncnn.html) [PPLNN-install](https://mmdeploy.readthedocs.io/en/latest/backends/pplnn.html), [OpenVINO-install](https://mmdeploy.readthedocs.io/en/latest/backends/openvino.html)。
2. 安装你的目标代码库。 你可以参考 [MMClassification-install](https://github.com/open-mmlab/mmclassification/blob/master/docs/zh_CN/install.md) [MMDetection-install](https://github.com/open-mmlab/mmdetection/blob/master/docs/zh_cn/get_started.md) [MMSegmentation-install](https://github.com/open-mmlab/mmsegmentation/blob/master/docs/zh_cn/get_started.md#installation) [MMOCR-install](https://mmocr.readthedocs.io/en/latest/install.html) [MMEditing-install](https://github.com/open-mmlab/mmediting/blob/master/docs/zh_cn/install.md)。
1. 安装您的目标后端。 您可以参考 [ONNXRuntime-install](https://mmdeploy.readthedocs.io/en/latest/backends/onnxruntime.html) [TensorRT-install](https://mmdeploy.readthedocs.io/en/latest/backends/tensorrt.html) [NCNN-install](https://mmdeploy.readthedocs.io/en/latest/backends/ncnn.html) [PPLNN-install](https://mmdeploy.readthedocs.io/en/latest/backends/pplnn.html), [OpenVINO-install](https://mmdeploy.readthedocs.io/en/latest/backends/openvino.html)。
2. 安装您的目标代码库。 您可以参考 [MMClassification-install](https://github.com/open-mmlab/mmclassification/blob/master/docs/zh_CN/install.md) [MMDetection-install](https://github.com/open-mmlab/mmdetection/blob/master/docs/zh_cn/get_started.md) [MMSegmentation-install](https://github.com/open-mmlab/mmsegmentation/blob/master/docs/zh_cn/get_started.md#installation) [MMOCR-install](https://mmocr.readthedocs.io/en/latest/install.html) [MMEditing-install](https://github.com/open-mmlab/mmediting/blob/master/docs/zh_cn/install.md)。
#### 使用方法
@ -63,9 +63,9 @@ python ./tools/deploy.py \
#### 如何查找pytorch模型对应的部署配置文件
1. 在 `configs/` 文件夹中找到模型对应的代码库文件夹。 例如转换一个yolov3模型可以查找到 `configs/mmdet` 文件夹。
2. 根据模型的任务类型在 `configs/codebase_folder/` 下查找对应的文件夹。 例如yolov3模型可以查找到 `configs/mmdet/detection` 文件夹。
3. 在 `configs/codebase_folder/task_folder/` 下找到模型的部署配置文件。 例如部署yolov3可以使用 `configs/mmdet/detection/detection_onnxruntime_dynamic.py`
1. 在 `configs/` 文件夹中找到模型对应的代码库文件夹。 例如转换一个yolov3模型可以查找到 `configs/mmdet` 文件夹。
2. 根据模型的任务类型在 `configs/codebase_folder/` 下查找对应的文件夹。 例如yolov3模型可以查找到 `configs/mmdet/detection` 文件夹。
3. 在 `configs/codebase_folder/task_folder/` 下找到模型的部署配置文件。 例如部署yolov3可以使用 `configs/mmdet/detection/detection_onnxruntime_dynamic.py`
#### 示例
@ -82,7 +82,7 @@ python ./tools/deploy.py \
### 如何评测模型
可以尝试去评测转换出来的模型 ,参考 [how_to_evaluate_a_model](./how_to_evaluate_a_model.md)。
可以尝试去评测转换出来的模型 ,参考 [how_to_evaluate_a_model](./how_to_evaluate_a_model.md)。
### 各后端已支持导出的模型列表

View File

@ -32,7 +32,7 @@ docker run --gpus all -it -p 8080:8081 mmdeploy:master-gpu
1. CUDA error: the provided PTX was compiled with an unsupported toolchain:
如 [这里](https://forums.developer.nvidia.com/t/cuda-error-the-provided-ptx-was-compiled-with-an-unsupported-toolchain/185754)所说,更新 GPU 的驱动到的GPU能使用的最新版本。
如 [这里](https://forums.developer.nvidia.com/t/cuda-error-the-provided-ptx-was-compiled-with-an-unsupported-toolchain/185754)所说,更新 GPU 的驱动到的GPU能使用的最新版本。
2. docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].
```

View File

@ -32,7 +32,7 @@ ONNX 配置信息描述了如何将PyTorch模型转换为ONNX模型。
### ONNX配置信息参数说明
- `type`: 配置信息类型。 默认为 `onnx`
- `export_params`: 如果指定,将导出模型所有参数。如果只想导出未训练模型将此项设置为 False。
- `export_params`: 如果指定,将导出模型所有参数。如果只想导出未训练模型将此项设置为 False。
- `keep_initializers_as_inputs`:
如果为 True则所有初始化器通常对应为参数也将作为输入导出添加到计算图中。 如果为 False则初始化器不会作为输入导出不添加到计算图中仅将非参数输入添加到计算图中。
@ -58,7 +58,7 @@ onnx_config = dict(
### 动态尺寸输入和输出配置
如果模型要求动态尺寸的输入和输出,需要在ONNX配置信息中加入dynamic_axes配置。
如果模型要求动态尺寸的输入和输出,需要在ONNX配置信息中加入dynamic_axes配置。
- `dynamic_axes`: 描述输入和输出的维度信息。
@ -171,7 +171,7 @@ onnx_config = dict(
```
- `task name`: 模型任务类型。
- `backend name`: 推理框架名称。注意:如果你使用了量化,你需要指出量化类型。例如 `tensorrt-int8`
- `backend name`: 推理框架名称。注意:如果您使用了量化,您需要指出量化类型。例如 `tensorrt-int8`
- `dynamic or static`: 动态或者静态尺寸导出。 注意:如果推理框架需要明确的形状信息,您需要添加输入大小的描述,格式为`高度 x 宽度`。 例如 `dynamic-512x1024-2048x2048`, 这意味着最小输入形状是`512x1024`,最大输入形状是`2048x2048`。
#### 示例