Skip to content

Commit

Permalink
[Docs] Fix mdformat version to support python3.6 (#2014)
Browse files Browse the repository at this point in the history
* [Docs] Refine documentation

* fix mdformat version to support python3.6

* remove ruby dependency from CI

* fix invalid links
  • Loading branch information
zhouzaida authored Jun 9, 2022
1 parent 834d597 commit 11d8554
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 213 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ jobs:
python-version: 3.7
- name: Install pre-commit hook
run: |
# markdownlint requires ruby >= 2.7
sudo apt-add-repository ppa:brightbox/ruby-ng -y
sudo apt-get update
sudo apt-get install -y ruby2.7
pip install pre-commit
pre-commit install
- name: Linting
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ repos:
hooks:
- id: codespell
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.14
rev: 0.7.9
hooks:
- id: mdformat
args: ["--number"]
additional_dependencies:
- mdformat-gfm
- mdformat-openmmlab
- mdformat_frontmatter
- linkify-it-py
- repo: https://github.com/myint/docformatter
Expand Down
46 changes: 23 additions & 23 deletions TERMINOLOGY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ This document is used as a reference for English-Chinese terminology translation

该文档用作中英文翻译对照参考。

| English | 中文 |
| :---------------: | :----: |
| annotation | 标注 |
| backbone | 主干网络 |
| benchmark | 基准测试 |
| English | 中文 |
| :---------------: | :----------: |
| annotation | 标注 |
| backbone | 主干网络 |
| benchmark | 基准测试 |
| checkpoint | 模型权重文件 |
| classifier | 分类器 |
| cls_head | 分类头 |
| decoder | 解码器 |
| detector | 检测器 |
| encoder | 编码器 |
| finetune | 微调 |
| ground truth | 真实标签 |
| hook | 钩子 |
| localizer | 定位器 |
| neck | 模型颈部 |
| pipeline | 流水线 |
| recognizer | 识别器 |
| register | 注册器 |
| schedule | 调整 |
| scheduler | 调度器 |
| segmentor | 分割器 |
| tensor | 张量 |
| training schedule | 训练策略 |
| classifier | 分类器 |
| cls_head | 分类头 |
| decoder | 解码器 |
| detector | 检测器 |
| encoder | 编码器 |
| finetune | 微调 |
| ground truth | 真实标签 |
| hook | 钩子 |
| localizer | 定位器 |
| neck | 模型颈部 |
| pipeline | 流水线 |
| recognizer | 识别器 |
| register | 注册器 |
| schedule | 调整 |
| scheduler | 调度器 |
| segmentor | 分割器 |
| tensor | 张量 |
| training schedule | 训练策略 |
4 changes: 2 additions & 2 deletions docs/en/deployment/onnxruntime_op.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Take custom operator `soft_nms` for example.

2. Add source `soft_nms.cpp` to ONNX Runtime source directory `mmcv/ops/csrc/onnxruntime/cpu/`

3. Register `soft_nms` operator in [onnxruntime_register.cpp](../../mmcv/ops/csrc/onnxruntime/cpu/onnxruntime_register.cpp)
3. Register `soft_nms` operator in [onnxruntime_register.cpp](../../../mmcv/ops/csrc/onnxruntime/cpu/onnxruntime_register.cpp)

```c++
#include "soft_nms.h"
Expand All @@ -133,4 +133,4 @@ Take custom operator `soft_nms` for example.
### References
- [How to export Pytorch model with custom op to ONNX and run it in ONNX Runtime](https://github.com/onnx/tutorials/blob/master/PyTorchCustomOperator/README.md)
- [How to add a custom operator/kernel in ONNX Runtime](https://github.com/microsoft/onnxruntime/blob/master/docs/AddingCustomOp.md)
- [How to add a custom operator/kernel in ONNX Runtime](https://onnxruntime.ai/docs/reference/operators/add-custom-op.html)
152 changes: 76 additions & 76 deletions docs/zh_cn/deployment/onnxruntime_custom_ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,55 @@

<!-- TOC -->

- [ONNX Runtime自定义算子](#onnx-runtime%E8%87%AA%E5%AE%9A%E4%B9%89%E7%AE%97%E5%AD%90)
- [ONNX Runtime自定义算子](#onnx-runtime自定义算子)
- [SoftNMS](#softnms)
- [描述](#%E6%8F%8F%E8%BF%B0)
- [模型参数](#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0)
- [输入](#%E8%BE%93%E5%85%A5)
- [输出](#%E8%BE%93%E5%87%BA)
- [类型约束](#%E7%B1%BB%E5%9E%8B%E7%BA%A6%E6%9D%9F)
- [描述](#描述)
- [模型参数](#模型参数)
- [输入](#输入)
- [输出](#输出)
- [类型约束](#类型约束)
- [RoIAlign](#roialign)
- [描述](#%E6%8F%8F%E8%BF%B0-1)
- [模型参数](#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0-1)
- [输入](#%E8%BE%93%E5%85%A5-1)
- [输出](#%E8%BE%93%E5%87%BA-1)
- [类型约束](#%E7%B1%BB%E5%9E%8B%E7%BA%A6%E6%9D%9F-1)
- [描述](#描述-1)
- [模型参数](#模型参数-1)
- [输入](#输入-1)
- [输出](#输出-1)
- [类型约束](#类型约束-1)
- [NMS](#nms)
- [描述](#%E6%8F%8F%E8%BF%B0-2)
- [模型参数](#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0-2)
- [输入](#%E8%BE%93%E5%85%A5-2)
- [输出](#%E8%BE%93%E5%87%BA-2)
- [类型约束](#%E7%B1%BB%E5%9E%8B%E7%BA%A6%E6%9D%9F-2)
- [描述](#描述-2)
- [模型参数](#模型参数-2)
- [输入](#输入-2)
- [输出](#输出-2)
- [类型约束](#类型约束-2)
- [grid_sampler](#grid_sampler)
- [描述](#%E6%8F%8F%E8%BF%B0-3)
- [模型参数](#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0-3)
- [输入](#%E8%BE%93%E5%85%A5-3)
- [输出](#%E8%BE%93%E5%87%BA-3)
- [类型约束](#%E7%B1%BB%E5%9E%8B%E7%BA%A6%E6%9D%9F-3)
- [描述](#描述-3)
- [模型参数](#模型参数-3)
- [输入](#输入-3)
- [输出](#输出-3)
- [类型约束](#类型约束-3)
- [CornerPool](#cornerpool)
- [描述](#%E6%8F%8F%E8%BF%B0-4)
- [模型参数](#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0-4)
- [输入](#%E8%BE%93%E5%85%A5-4)
- [输出](#%E8%BE%93%E5%87%BA-4)
- [类型约束](#%E7%B1%BB%E5%9E%8B%E7%BA%A6%E6%9D%9F-4)
- [描述](#描述-4)
- [模型参数](#模型参数-4)
- [输入](#输入-4)
- [输出](#输出-4)
- [类型约束](#类型约束-4)
- [cummax](#cummax)
- [描述](#%E6%8F%8F%E8%BF%B0-5)
- [模型参数](#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0-5)
- [输入](#%E8%BE%93%E5%85%A5-5)
- [输出](#%E8%BE%93%E5%87%BA-5)
- [类型约束](#%E7%B1%BB%E5%9E%8B%E7%BA%A6%E6%9D%9F-5)
- [描述](#描述-5)
- [模型参数](#模型参数-5)
- [输入](#输入-5)
- [输出](#输出-5)
- [类型约束](#类型约束-5)
- [cummin](#cummin)
- [描述](#%E6%8F%8F%E8%BF%B0-6)
- [模型参数](#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0-6)
- [输入](#%E8%BE%93%E5%85%A5-6)
- [输出](#%E8%BE%93%E5%87%BA-6)
- [类型约束](#%E7%B1%BB%E5%9E%8B%E7%BA%A6%E6%9D%9F-6)
- [描述](#描述-6)
- [模型参数](#模型参数-6)
- [输入](#输入-6)
- [输出](#输出-6)
- [类型约束](#类型约束-6)
- [MMCVModulatedDeformConv2d](#mmcvmodulateddeformconv2d)
- [描述](#%E6%8F%8F%E8%BF%B0-7)
- [模型参数](#%E6%A8%A1%E5%9E%8B%E5%8F%82%E6%95%B0-7)
- [输入](#%E8%BE%93%E5%85%A5-7)
- [输出](#%E8%BE%93%E5%87%BA-7)
- [类型约束](#%E7%B1%BB%E5%9E%8B%E7%BA%A6%E6%9D%9F-7)
- [描述](#描述-7)
- [模型参数](#模型参数-7)
- [输入](#输入-7)
- [输出](#输出-7)
- [类型约束](#类型约束-7)

<!-- TOC -->

Expand All @@ -62,13 +62,13 @@

#### 模型参数

| 类型 | 参数名 | 描述 |
| ------- | --------------- | -------------------------------------------------- |
| `float` | `iou_threshold` | 用来判断候选框重合度的阈值,取值范围\[0, 1\]。默认值为0 |
| `float` | `sigma` | 高斯方法的超参数 |
| `float` | `min_score` | NMS的score阈值 |
| 类型 | 参数名 | 描述 |
| ------- | --------------- | ------------------------------------------------------- |
| `float` | `iou_threshold` | 用来判断候选框重合度的阈值,取值范围\[0, 1\]。默认值为0 |
| `float` | `sigma` | 高斯方法的超参数 |
| `float` | `min_score` | NMS的score阈值 |
| `int` | `method` | NMS的计算方式, (0: `naive`, 1: `linear`, 2: `gaussian`) |
| `int` | `offset` | 用来计算候选框的宽高(x2 - x1 + offset)。可选值0或1 |
| `int` | `offset` | 用来计算候选框的宽高(x2 - x1 + offset)。可选值0或1 |

#### 输入

Expand Down Expand Up @@ -100,13 +100,13 @@

#### 模型参数

| 类型 | 参数名 | 描述 |
| ------- | ---------------- | ----------------------------------- |
| `int` | `output_height` | roi特征的输出高度 |
| `int` | `output_width` | roi特征的输出宽度 |
| `float` | `spatial_scale` | 输入检测框的缩放系数 |
| `int` | `sampling_ratio` | 输出的采样率。`0`表示使用密集采样 |
| `str` | `mode` | 池化方式。 `avg``max` |
| 类型 | 参数名 | 描述 |
| ------- | ---------------- | ------------------------------------------------------- |
| `int` | `output_height` | roi特征的输出高度 |
| `int` | `output_width` | roi特征的输出宽度 |
| `float` | `spatial_scale` | 输入检测框的缩放系数 |
| `int` | `sampling_ratio` | 输出的采样率。`0`表示使用密集采样 |
| `str` | `mode` | 池化方式。 `avg``max` |
| `int` | `aligned` | 如果`aligned=1`,则像素会进行-0.5的偏移以达到更好的对齐 |

#### 输入
Expand Down Expand Up @@ -137,10 +137,10 @@

#### 模型参数

| 类型 | 参数名 | 描述 |
| ------- | --------------- | ----------------------------------- |
| `float` | `iou_threshold` | 用来判断候选框重合度的阈值,取值范围\[0, 1\]。默认值为0 |
| `int` | `offset` | 用来计算候选框的宽高(x2 - x1 + offset)。可选值0或1 |
| 类型 | 参数名 | 描述 |
| ------- | --------------- | ------------------------------------------------------- |
| `float` | `iou_threshold` | 用来判断候选框重合度的阈值,取值范围\[0, 1\]。默认值为0 |
| `int` | `offset` | 用来计算候选框的宽高(x2 - x1 + offset)。可选值0或1 |

#### 输入

Expand Down Expand Up @@ -170,10 +170,10 @@

#### 模型参数

| 类型 | 参数名 | 描述 |
| ----- | -------------------- | ------------------------------------------------------------------------------------------------ |
| `int` | `interpolation_mode` | 计算输出使用的插值模式。(0: `bilinear` , 1: `nearest`) |
| `int` | `padding_mode` | 边缘填充模式。(0: `zeros`, 1: `border`, 2: `reflection`) |
| 类型 | 参数名 | 描述 |
| ----- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `int` | `interpolation_mode` | 计算输出使用的插值模式。(0: `bilinear` , 1: `nearest`) |
| `int` | `padding_mode` | 边缘填充模式。(0: `zeros`, 1: `border`, 2: `reflection`) |
| `int` | `align_corners` | 如果`align_corners=1`,则极值(`-1``1`)会被当做输入边缘像素的中心点。如果`align_corners=0`,则它们会被看做是边缘像素的边缘点,减小分辨率对采样的影响 |

#### 输入
Expand Down Expand Up @@ -204,8 +204,8 @@

#### 模型参数

| 类型 | 参数名 | 描述 |
| ----- | ------ | --------------------------------------------------- |
| 类型 | 参数名 | 描述 |
| ----- | ------ | -------------------------------------------------------- |
| `int` | `mode` | 池化模式。(0: `top`, 1: `bottom`, 2: `left`, 3: `right`) |

#### 输入
Expand Down Expand Up @@ -234,9 +234,9 @@

#### 模型参数

| 类型 | 参数名 | 描述 |
| ----- | ----- | --------- |
| `int` | `dim` | 进行累计计算的维度 |
| 类型 | 参数名 | 描述 |
| ----- | ------ | ------------------ |
| `int` | `dim` | 进行累计计算的维度 |

#### 输入

Expand Down Expand Up @@ -266,9 +266,9 @@

#### 模型参数

| 类型 | 参数名 | 描述 |
| ----- | ----- | --------- |
| `int` | `dim` | 进行累计计算的维度 |
| 类型 | 参数名 | 描述 |
| ----- | ------ | ------------------ |
| `int` | `dim` | 进行累计计算的维度 |

#### 输入

Expand Down Expand Up @@ -298,12 +298,12 @@

#### 模型参数

| 类型 | 参数名 | 描述 |
| -------------- | ------------------- | -------------------------------------- |
| `list of ints` | `stride` | 卷积的步长 (sH, sW) |
| `list of ints` | `padding` | 输入特征填充大小 (padH, padW) |
| `list of ints` | `dilation` | 卷积核各元素间隔 (dH, dW) |
| `int` | `deformable_groups` | 可变偏移量的分组,通常置位1即可 |
| 类型 | 参数名 | 描述 |
| -------------- | ------------------- | ------------------------------------------------------------- |
| `list of ints` | `stride` | 卷积的步长 (sH, sW) |
| `list of ints` | `padding` | 输入特征填充大小 (padH, padW) |
| `list of ints` | `dilation` | 卷积核各元素间隔 (dH, dW) |
| `int` | `deformable_groups` | 可变偏移量的分组,通常置位1即可 |
| `int` | `groups` | 卷积分组数,`input_channel`会根据这个值被分为数个分组进行计算 |

#### 输入
Expand Down
24 changes: 12 additions & 12 deletions docs/zh_cn/deployment/onnxruntime_op.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@

### MMCV已支持的算子

| 算子 | CPU | GPU | MMCV版本 |
| :------------------------------------------------------------------------------: | :-: | :-: | :----: |
| [SoftNMS](onnxruntime_custom_ops.md#softnms) | Y | N | 1.2.3 |
| [RoIAlign](onnxruntime_custom_ops.md#roialign) | Y | N | 1.2.5 |
| [NMS](onnxruntime_custom_ops.md#nms) | Y | N | 1.2.7 |
| [grid_sampler](onnxruntime_custom_ops.md#grid_sampler) | Y | N | 1.3.1 |
| [CornerPool](onnxruntime_custom_ops.md#cornerpool) | Y | N | 1.3.4 |
| [cummax](onnxruntime_custom_ops.md#cummax) | Y | N | 1.3.4 |
| [cummin](onnxruntime_custom_ops.md#cummin) | Y | N | 1.3.4 |
| [MMCVModulatedDeformConv2d](onnxruntime_custom_ops.md#mmcvmodulateddeformconv2d) | Y | N | 1.3.12 |
| 算子 | CPU | GPU | MMCV版本 |
| :------------------------------------------------------------------------------: | :-: | :-: | :------: |
| [SoftNMS](onnxruntime_custom_ops.md#softnms) | Y | N | 1.2.3 |
| [RoIAlign](onnxruntime_custom_ops.md#roialign) | Y | N | 1.2.5 |
| [NMS](onnxruntime_custom_ops.md#nms) | Y | N | 1.2.7 |
| [grid_sampler](onnxruntime_custom_ops.md#grid_sampler) | Y | N | 1.3.1 |
| [CornerPool](onnxruntime_custom_ops.md#cornerpool) | Y | N | 1.3.4 |
| [cummax](onnxruntime_custom_ops.md#cummax) | Y | N | 1.3.4 |
| [cummin](onnxruntime_custom_ops.md#cummin) | Y | N | 1.3.4 |
| [MMCVModulatedDeformConv2d](onnxruntime_custom_ops.md#mmcvmodulateddeformconv2d) | Y | N | 1.3.12 |

### 如何编译ONNX Runtime自定义算子?

Expand Down Expand Up @@ -100,7 +100,7 @@ onnx_results = sess.run(None, {'input' : input_data})

2. 在ONNX Runtime源码目录`mmcv/ops/csrc/onnxruntime/cpu/`下添加算子实现`soft_nms.cpp`

3.[onnxruntime_register.cpp](../../mmcv/ops/csrc/onnxruntime/cpu/onnxruntime_register.cpp)中注册实现的算子`soft_nms`
3.[onnxruntime_register.cpp](../../../mmcv/ops/csrc/onnxruntime/cpu/onnxruntime_register.cpp)中注册实现的算子`soft_nms`

```c++
#include "soft_nms.h"
Expand All @@ -126,4 +126,4 @@ onnx_results = sess.run(None, {'input' : input_data})
### 引用
- [How to export Pytorch model with custom op to ONNX and run it in ONNX Runtime](https://github.com/onnx/tutorials/blob/master/PyTorchCustomOperator/README.md)
- [How to add a custom operator/kernel in ONNX Runtime](https://github.com/microsoft/onnxruntime/blob/master/docs/AddingCustomOp.md)
- [How to add a custom operator/kernel in ONNX Runtime](https://onnxruntime.ai/docs/reference/operators/add-custom-op.html)
Loading

0 comments on commit 11d8554

Please sign in to comment.