Skip to content

Commit 671d626

Browse files
Generate supported-backends markdown table (#1986)
* Generate supported-backends markdown table * Generate supported-backends markdown table * update branch * update codebase dir * update backends nargs * update args to capitals * center alignment starting from the 3rd coloumn * center alignment starting from the 3rd coloumn * fix bad urls * fix bad urls * Update codebases.txt fix circleci * Update codebases.txt --------- Co-authored-by: RunningLeon <mnsheng@yeah.net>
1 parent 6c26e88 commit 671d626

File tree

15 files changed

+178
-4
lines changed

15 files changed

+178
-4
lines changed

docs/en/02-how-to-run/useful_tools.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,45 @@ And the output look like this:
202202
| Max | 1.689 | 591.983 |
203203
+--------+------------+---------+
204204
```
205+
206+
## generate_md_table
207+
208+
This tool can be used to generate supported-backends markdown table.
209+
210+
### Usage
211+
212+
```shell
213+
python tools/generate_md_table.py \
214+
${YML_FILE} \
215+
${OUTPUT} \
216+
--backends ${BACKENDS}
217+
```
218+
219+
### Description of all arguments
220+
221+
- `yml_file:` input yml config path
222+
- `output:` output markdown file path
223+
- `--backends:` output backends list. If not specified, it will be set 'onnxruntime' 'tensorrt' 'torchscript' 'pplnn' 'openvino' 'ncnn'.
224+
225+
### Example:
226+
227+
Generate backends markdown table from mmocr.yml
228+
229+
```shell
230+
python tools/generate_md_table.py tests/regression/mmocr.yml tests/regression/mmocr.md --backends onnxruntime tensorrt torchscript pplnn openvino ncnn
231+
```
232+
233+
And the output look like this:
234+
235+
| model | task | onnxruntime | tensorrt | torchscript | pplnn | openvino | ncnn |
236+
| :----------------------------------------------------------------------------------- | :-------------- | :---------: | :------: | :---------: | :---: | :------: | :--: |
237+
| [DBNet](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/dbnet) | TextDetection | Y | Y | Y | Y | Y | Y |
238+
| [DBNetpp](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/dbnetpp) | TextDetection | Y | Y | N | N | Y | Y |
239+
| [PANet](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/panet) | TextDetection | Y | Y | Y | Y | Y | Y |
240+
| [PSENet](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/psenet) | TextDetection | Y | Y | Y | Y | Y | Y |
241+
| [TextSnake](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/textsnake) | TextDetection | Y | Y | Y | N | N | N |
242+
| [MaskRCNN](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/maskrcnn) | TextDetection | Y | Y | Y | N | N | N |
243+
| [CRNN](https://github.com/open-mmlab/mmocr/tree/main/configs/textrecog/crnn) | TextRecognition | Y | Y | Y | Y | N | Y |
244+
| [SAR](https://github.com/open-mmlab/mmocr/tree/main/configs/textrecog/sar) | TextRecognition | Y | N | Y | N | N | N |
245+
| [SATRN](https://github.com/open-mmlab/mmocr/tree/main/configs/textrecog/satrn) | TextRecognition | Y | Y | Y | N | N | N |
246+
| [ABINet](https://github.com/open-mmlab/mmocr/tree/main/configs/textrecog/abinet) | TextRecognition | Y | Y | Y | N | N | N |

docs/zh_cn/02-how-to-run/useful_tools.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,45 @@ python tools/profiler.py \
202202
| Max | 1.689 | 591.983 |
203203
+--------+------------+---------+
204204
```
205+
206+
## generate_md_table
207+
208+
生成mmdeploy支持的后端表。
209+
210+
### 用法
211+
212+
```shell
213+
python tools/generate_md_table.py \
214+
${YML_FILE} \
215+
${OUTPUT} \
216+
--backends ${BACKENDS}
217+
```
218+
219+
### 参数说明
220+
221+
- `yml_file:` 输入 yml 配置路径
222+
- `output:` 输出markdown文件路径
223+
- `--backends:` 要输出的后端,默认为 onnxruntime tensorrt torchscript pplnn openvino ncnn
224+
225+
### 使用举例
226+
227+
从 mmocr.yml 生成mmdeploy支持的后端表
228+
229+
```shell
230+
python tools/generate_md_table.py tests/regression/mmocr.yml tests/regression/mmocr.md --backends onnxruntime tensorrt torchscript pplnn openvino ncnn
231+
```
232+
233+
输出:
234+
235+
| model | task | onnxruntime | tensorrt | torchscript | pplnn | openvino | ncnn |
236+
| :----------------------------------------------------------------------------------- | :-------------- | :---------: | :------: | :---------: | :---: | :------: | :--: |
237+
| [DBNet](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/dbnet) | TextDetection | Y | Y | Y | Y | Y | Y |
238+
| [DBNetpp](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/dbnetpp) | TextDetection | Y | Y | N | N | Y | Y |
239+
| [PANet](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/panet) | TextDetection | Y | Y | Y | Y | Y | Y |
240+
| [PSENet](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/psenet) | TextDetection | Y | Y | Y | Y | Y | Y |
241+
| [TextSnake](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/textsnake) | TextDetection | Y | Y | Y | N | N | N |
242+
| [MaskRCNN](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/maskrcnn) | TextDetection | Y | Y | Y | N | N | N |
243+
| [CRNN](https://github.com/open-mmlab/mmocr/tree/main/configs/textrecog/crnn) | TextRecognition | Y | Y | Y | Y | N | Y |
244+
| [SAR](https://github.com/open-mmlab/mmocr/tree/main/configs/textrecog/sar) | TextRecognition | Y | N | Y | N | N | N |
245+
| [SATRN](https://github.com/open-mmlab/mmocr/tree/main/configs/textrecog/satrn) | TextRecognition | Y | Y | Y | N | N | N |
246+
| [ABINet](https://github.com/open-mmlab/mmocr/tree/main/configs/textrecog/abinet) | TextRecognition | Y | Y | Y | N | N | N |

docs/zh_cn/tutorial/03_pytorch2onnx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ ONNX 算子的定义情况,都可以在官方的[算子文档](https://github.
280280

281281
### PyTorch 对 ONNX 算子的映射
282282

283-
在 PyTorch 中,和 ONNX 有关的定义全部放在 [torch.onnx 目录](https://github.com/pytorch/pytorch/tree/master/torch/onnx)中,如下图所示:
283+
在 PyTorch 中,和 ONNX 有关的定义全部放在 [torch.onnx 目录](https://github.com/pytorch/pytorch/tree/main/torch/onnx)中,如下图所示:
284284

285285
![image](https://user-images.githubusercontent.com/47652064/163531700-ddf994e5-6989-483c-a1a3-f1b50dfd84f0.png)
286286

docs/zh_cn/tutorial/04_onnx_custom_op.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def symbolic(g,
233233

234234
在这个符号函数中,我们以刚刚搜索到的算子输入参数作为符号函数的输入参数,并只用 `input``offset` 来构造一个简单的 ONNX 算子。
235235

236-
这段代码中,最令人疑惑的就是装饰器 `@parse_args` 了。简单来说,TorchScript 算子的符号函数要求标注出每一个输入参数的类型。比如"v"表示 Torch 库里的 `value` 类型,一般用于标注张量,而"i"表示 int 类型,"f"表示 float 类型,"none"表示该参数为空。具体的类型含义可以在 [torch.onnx.symbolic_helper.py](https://github.com/pytorch/pytorch/blob/master/torch/onnx/symbolic_helper.py)中查看。这里输入参数中的 `input, weight, offset, mask, bias` 都是张量,所以用"v"表示。后面的其他参数同理。我们不必纠结于 `@parse_args`的原理,根据实际情况对符号函数的参数标注类型即可。
236+
这段代码中,最令人疑惑的就是装饰器 `@parse_args` 了。简单来说,TorchScript 算子的符号函数要求标注出每一个输入参数的类型。比如"v"表示 Torch 库里的 `value` 类型,一般用于标注张量,而"i"表示 int 类型,"f"表示 float 类型,"none"表示该参数为空。具体的类型含义可以在 [torch.onnx.symbolic_helper.py](https://github.com/pytorch/pytorch/blob/main/torch/onnx/symbolic_helper.py)中查看。这里输入参数中的 `input, weight, offset, mask, bias` 都是张量,所以用"v"表示。后面的其他参数同理。我们不必纠结于 `@parse_args`的原理,根据实际情况对符号函数的参数标注类型即可。
237237

238238
有了符号函数后,我们通过如下的方式注册符号函数:
239239

requirements/codebases.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ mmedit>=1.0.0rc2
55
mmocr>=1.0.0rc4
66
mmpose>=1.0.0rc0
77
mmrotate>=1.0.0rc0
8-
mmsegmentation @ git+https://github.com/open-mmlab/mmsegmentation.git@dev-1.x
8+
mmsegmentation>=1.0.0

tests/regression/mmaction.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
globals:
2+
repo_url: https://github.com/open-mmlab/mmaction2/tree/main
23
codebase_dir: ../mmaction2
34
checkpoint_force_download: False
45
images:

tests/regression/mmcls.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
globals:
2-
codebase_dir: ../mmclassification
2+
repo_url: https://github.com/open-mmlab/mmpretrain/tree/main
3+
codebase_dir: ../mmpretrain
34
checkpoint_force_download: False
45
images:
56
img_snake: &img_snake ../mmclassification/demo/demo.JPEG

tests/regression/mmdet.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
globals:
2+
repo_url: https://github.com/open-mmlab/mmdetection/tree/main
23
codebase_dir: ../mmdetection
34
checkpoint_force_download: False
45
images:

tests/regression/mmdet3d.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
globals:
2+
repo_url: https://github.com/open-mmlab/mmdetection3d/tree/main
23
codebase_dir: ../mmdetection3d
34
checkpoint_force_download: False
45
images:

tests/regression/mmedit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
globals:
2+
repo_url: https://github.com/open-mmlab/mmediting/tree/main
23
codebase_dir: ../mmediting
34
checkpoint_force_download: False
45
images:

0 commit comments

Comments
 (0)