Skip to content

Commit

Permalink
format md docs with mdformater
Browse files Browse the repository at this point in the history
  • Loading branch information
RunningLeon committed May 18, 2022
1 parent 9baecee commit 101108f
Show file tree
Hide file tree
Showing 52 changed files with 1,008 additions and 811 deletions.
30 changes: 15 additions & 15 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Expand Down Expand Up @@ -70,7 +70,7 @@ members of the project's leadership.
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

[homepage]: https://www.contributor-covenant.org
6 changes: 2 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

Thanks for your bug report. We appreciate it a lot.
Expand All @@ -29,13 +28,12 @@ A placeholder for the command.

2. Did you make any modifications on the code or config? Did you understand what you have modified?


**Environment**

1. Please run `python tools/check_env.py` to collect necessary environment information and paste it here.
2. You may add addition that may be helpful for locating the problem, such as
- How you installed PyTorch [e.g., pip, conda, source]
- Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.)
- How you installed PyTorch \[e.g., pip, conda, source\]
- Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.)

**Error traceback**

Expand Down
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Describe the feature**

**Motivation**

A clear and concise description of the motivation of the feature.
Ex1. It is inconvenient when [....].
Ex1. It is inconvenient when \[....\].

**Related resources**

Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/general_questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ about: Ask general questions to get help
title: ''
labels: ''
assignees: ''

---
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ a part of the [OpenMMLab](https://openmmlab.com/) project.
<img src="resources/introduction.png" width="800"/>
</div>


### Major features

- **Fully support OpenMMLab models**

We provide a unified model deployment toolbox for the codebases in OpenMMLab. The supported codebases are listed as below, and more will be added in the future

- [x] MMClassification
- [x] MMDetection
- [x] MMSegmentation
Expand All @@ -53,6 +53,7 @@ a part of the [OpenMMLab](https://openmmlab.com/) project.
- **Multiple inference backends are available**

Models can be exported and run in different backends. The following ones are supported, and more will be taken into consideration

- [x] ONNX Runtime
- [x] TensorRT
- [x] PPLNN
Expand All @@ -61,7 +62,7 @@ a part of the [OpenMMLab](https://openmmlab.com/) project.

- **Efficient and highly scalable SDK Framework by C/C++**

All kinds of modules in SDK can be extensible, such as `Transform` for image processing, `Net` for Neural Network inference, `Module` for postprocessing and so on
All kinds of modules in SDK can be extensible, such as `Transform` for image processing, `Net` for Neural Network inference, `Module` for postprocessing and so on

## License

Expand Down Expand Up @@ -93,6 +94,7 @@ We appreciate all contributions to improve MMDeploy. Please refer to [CONTRIBUTI
## Acknowledgement

We would like to sincerely thank the following teams for their contributions to [MMDeploy](https://github.com/open-mmlab/mmdeploy):

- [OpenPPL](https://github.com/openppl-public)
- [OpenVINO](https://github.com/openvinotoolkit/openvino)

Expand Down
2 changes: 2 additions & 0 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ MMDeploy 是一个开源深度学习模型部署工具箱,它是 [OpenMMLab](h
- **全面支持 OpenMMLab 模型的部署**

我们为 OpenMMLab 各算法库提供了统一的模型部署工具箱。已支持的算法库如下所示,未来将支持更多的算法库

- [x] MMClassification
- [x] MMDetection
- [x] MMSegmentation
Expand All @@ -51,6 +52,7 @@ MMDeploy 是一个开源深度学习模型部署工具箱,它是 [OpenMMLab](h
- **支持多种推理后端**

模型可以导出为多种推理引擎文件,并在对应的后端上进行推理。 如下后端已经支持,后续将支持更多的后端。

- [x] ONNX Runtime
- [x] TensorRT
- [x] PPLNN
Expand Down
11 changes: 8 additions & 3 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
## Demo

We provide a demo showing what our mmdeploy can do for general model deployment.

In `demo_rewrite.py`, a resnet18 model from `torchvision` is rewritten through mmdeploy tool. In our rewritten model, the forward function of resnet gets modified to only down sample the original input to 4x. Original onnx model of resnet18 and its rewritten are visualized through [netron](https://netron.app/).

### Prerequisite

Before we run `demp_rewrite.py`, we need to install `pyppeteer` through:

```
pip install pyppeteer
```

### Demo results

The original resnet18 model and its modified one are visualized as follows. The left model is the original resnet18 while the right model is exported after rewritten.
Original resnet18 | Rewritten model
:-------------------------:|:-------------------------:
![](resources/original.png) | ![](resources/rewritten.png)

| Original resnet18 | Rewritten model |
| :-------------------------: | :--------------------------: |
| ![](resources/original.png) | ![](resources/rewritten.png) |
79 changes: 41 additions & 38 deletions docs/en/backends/ncnn.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,48 @@ MMDeploy now supports ncnn version == 1.0.20220216

- Download VulkanTools for the compilation of ncnn.

```bash
wget https://sdk.lunarg.com/sdk/download/1.2.176.1/linux/vulkansdk-linux-x86_64-1.2.176.1.tar.gz?Human=true -O vulkansdk-linux-x86_64-1.2.176.1.tar.gz
tar -xf vulkansdk-linux-x86_64-1.2.176.1.tar.gz
export VULKAN_SDK=$(pwd)/1.2.176.1/x86_64
export LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH
```
```bash
wget https://sdk.lunarg.com/sdk/download/1.2.176.1/linux/vulkansdk-linux-x86_64-1.2.176.1.tar.gz?Human=true -O vulkansdk-linux-x86_64-1.2.176.1.tar.gz
tar -xf vulkansdk-linux-x86_64-1.2.176.1.tar.gz
export VULKAN_SDK=$(pwd)/1.2.176.1/x86_64
export LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH
```

- Check your gcc version.
You should ensure your gcc satisfies `gcc >= 6`.
You should ensure your gcc satisfies `gcc >= 6`.

- Install Protocol Buffers through:

```bash
apt-get install libprotobuf-dev protobuf-compiler
```

- Prepare ncnn Framework

- Download ncnn source code

```bash
apt-get install libprotobuf-dev protobuf-compiler
git clone -b 20220216 git@github.com:Tencent/ncnn.git
```

- Prepare ncnn Framework
- <font color=red>Make install</font> ncnn library

- Download ncnn source code
```bash
git clone -b 20220216 git@github.com:Tencent/ncnn.git
```

- <font color=red>Make install</font> ncnn library
```bash
cd ncnn
export NCNN_DIR=$(pwd)
git submodule update --init
mkdir -p build && cd build
cmake -DNCNN_VULKAN=ON -DNCNN_SYSTEM_GLSLANG=ON -DNCNN_BUILD_EXAMPLES=ON -DNCNN_PYTHON=ON -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=ON -DNCNN_BUILD_TESTS=ON ..
make install
```

- Install pyncnn module
```bash
cd ${NCNN_DIR} # To NCNN root directory
cd python
pip install -e .
```
```bash
cd ncnn
export NCNN_DIR=$(pwd)
git submodule update --init
mkdir -p build && cd build
cmake -DNCNN_VULKAN=ON -DNCNN_SYSTEM_GLSLANG=ON -DNCNN_BUILD_EXAMPLES=ON -DNCNN_PYTHON=ON -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=ON -DNCNN_BUILD_TESTS=ON ..
make install
```

- Install pyncnn module

```bash
cd ${NCNN_DIR} # To NCNN root directory
cd python
pip install -e .
```

#### Build custom ops

Expand All @@ -70,11 +74,10 @@ If you haven't installed NCNN in the default path, please add `-Dncnn_DIR` flag
- This follows the tutorial on [How to convert model](../tutorials/how_to_convert_model.md).
- The converted model has two files: `.param` and `.bin`, as model structure file and weight file respectively.
### List of supported custom ops
| Operator | CPU | MMDeploy Releases |
|:--------------------------------|:---:|:------------------|
| :------------------------------ | :-: | :---------------- |
| [Expand](../ops/ncnn.md#expand) | Y | master |
| [Gather](../ops/ncnn.md#gather) | Y | master |
| [Shape](../ops/ncnn.md#shape) | Y | master |
Expand All @@ -88,11 +91,11 @@ If you haven't installed NCNN in the default path, please add `-Dncnn_DIR` flag
1. When running ncnn models for inference with custom ops, it fails and shows the error message like:
```bash
TypeError: register mm custom layers(): incompatible function arguments. The following argument types are supported:
1.(ar0: ncnn:Net) -> int
```bash
TypeError: register mm custom layers(): incompatible function arguments. The following argument types are supported:
1.(ar0: ncnn:Net) -> int
Invoked with: <ncnn.ncnn.Net object at 0x7f7fc4038bb0>
```
Invoked with: <ncnn.ncnn.Net object at 0x7f7fc4038bb0>
```
This is because of the failure to bind ncnn C++ library to pyncnn. You should build pyncnn from C++ ncnn source code, but not by `pip install`
This is because of the failure to bind ncnn C++ library to pyncnn. You should build pyncnn from C++ ncnn source code, but not by `pip install`
20 changes: 10 additions & 10 deletions docs/en/backends/onnxruntime.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ Note:

- If you want to save onnxruntime env variables to bashrc, you could run

```bash
echo '# set env for onnxruntime' >> ~/.bashrc
echo "export ONNXRUNTIME_DIR=${ONNXRUNTIME_DIR}" >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
```
```bash
echo '# set env for onnxruntime' >> ~/.bashrc
echo "export ONNXRUNTIME_DIR=${ONNXRUNTIME_DIR}" >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
```

#### Build on Linux

Expand All @@ -55,10 +55,10 @@ make -j$(nproc)

### List of supported custom ops

| Operator | CPU | GPU | MMDeploy Releases |
| :--------------------------------------------------------------------------- | :---: | :---: | :---------------- |
| [grid_sampler](../ops/onnxruntime.md#grid_sampler) | Y | N | master |
| [MMCVModulatedDeformConv2d](../ops/onnxruntime.md#mmcvmodulateddeformconv2d) | Y | N | master |
| Operator | CPU | GPU | MMDeploy Releases |
| :--------------------------------------------------------------------------- | :-: | :-: | :---------------- |
| [grid_sampler](../ops/onnxruntime.md#grid_sampler) | Y | N | master |
| [MMCVModulatedDeformConv2d](../ops/onnxruntime.md#mmcvmodulateddeformconv2d) | Y | N | master |

### How to add a new custom op

Expand Down
19 changes: 14 additions & 5 deletions docs/en/backends/openvino.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
## OpenVINO Support

This tutorial is based on Linux systems like Ubuntu-18.04.

### Installation

It is recommended to create a virtual environment for the project.

1. Install [OpenVINO](https://docs.openvino.ai/2021.4/get_started.html). It is recommended to use the installer or install using pip.
Installation example using [pip](https://pypi.org/project/openvino-dev/):
Installation example using [pip](https://pypi.org/project/openvino-dev/):

```bash
pip install openvino-dev
```
2. *`Optional` If you want to use OpenVINO in SDK, you need install OpenVINO with [install_guides](https://docs.openvino.ai/2021.4/openvino_docs_install_guides_installing_openvino_linux.html#install-openvino).

2. \*`Optional` If you want to use OpenVINO in SDK, you need install OpenVINO with [install_guides](https://docs.openvino.ai/2021.4/openvino_docs_install_guides_installing_openvino_linux.html#install-openvino).

3. Install MMDeploy following the [instructions](../build.md).

Expand All @@ -17,14 +22,17 @@ To work with models from [MMDetection](https://github.com/open-mmlab/mmdetection
### Troubleshooting

#### ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
To resolve missing external dependency on Ubuntu*, execute the following command:

To resolve missing external dependency on Ubuntu\*, execute the following command:

```bash
sudo apt-get install libpython3.7
```

### Usage

Example:

```bash
python tools/deploy.py \
configs/mmdet/detection/detection_openvino_static-300x300.py \
Expand All @@ -39,6 +47,7 @@ python tools/deploy.py \
### List of supported models exportable to OpenVINO from MMDetection

The table below lists the models that are guaranteed to be exportable to OpenVINO from MMDetection.

| Model name | Config | Dynamic Shape |
| :----------------: | :-----------------------------------------------------------------------: | :-----------: |
| ATSS | `configs/atss/atss_r50_fpn_1x_coco.py` | Y |
Expand All @@ -60,7 +69,7 @@ Notes:

- Custom operations from OpenVINO use the domain `org.openvinotoolkit`.
- For faster work in OpenVINO in the Faster-RCNN, Mask-RCNN, Cascade-RCNN, Cascade-Mask-RCNN models
the RoiAlign operation is replaced with the [ExperimentalDetectronROIFeatureExtractor](https://docs.openvinotoolkit.org/latest/openvino_docs_ops_detection_ExperimentalDetectronROIFeatureExtractor_6.html) operation in the ONNX graph.
the RoiAlign operation is replaced with the [ExperimentalDetectronROIFeatureExtractor](https://docs.openvinotoolkit.org/latest/openvino_docs_ops_detection_ExperimentalDetectronROIFeatureExtractor_6.html) operation in the ONNX graph.
- Models "VFNet" and "Faster R-CNN + DCN" use the custom "DeformableConv2D" operation.

### Deployment config
Expand All @@ -69,6 +78,7 @@ With the deployment config, you can specify additional options for the Model Opt
To do this, add the necessary parameters to the `backend_config.mo_options` in the fields `args` (for parameters with values) and `flags` (for flags).

Example:

```python
backend_config = dict(
mo_options=dict(
Expand All @@ -84,7 +94,6 @@ backend_config = dict(

Information about the possible parameters for the Model Optimizer can be found in the [documentation](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html).


### FAQs

- None
1 change: 1 addition & 0 deletions docs/en/backends/pplnn.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This tutorial is based on Linux systems like Ubuntu-18.04.
### Usage

Example:

```bash
python tools/deploy.py \
configs/mmdet/detection/detection_pplnn_dynamic-800x1344.py \
Expand Down
Loading

0 comments on commit 101108f

Please sign in to comment.