Skip to content

Commit

Permalink
[Docs] Update docs for mmdeploy main (#2216)
Browse files Browse the repository at this point in the history
  • Loading branch information
irexyc authored Apr 13, 2023
1 parent 683a19c commit 102f49c
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 123 deletions.
6 changes: 3 additions & 3 deletions projects/mmpose4aigc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ bash install_posetracker_linux.sh
After installation, files are organized as follows:

```shell
|----mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1
| |----sdk
|----mmdeploy-1.0.0-linux-x86_64-cxx11abi
| |----README.md
| |----rtmpose-ort
| | |----rtmdet-nano
| | |----rtmpose-m
Expand All @@ -83,7 +83,7 @@ Run the following command to generate a skeleton image:
```shell
# generate a skeleton image
bash mmpose_style_skeleton.sh \
mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1/rtmpose-ort/000000147979.jpg
mmdeploy-1.0.0-linux-x86_64-cxx11abi/rtmpose-ort/000000147979.jpg
```

For more details, you can refer to [RTMPose](../rtmpose/README.md).
Expand Down
6 changes: 3 additions & 3 deletions projects/mmpose4aigc/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ bash install_posetracker_linux.sh
ζœ€η»ˆηš„ζ–‡δ»Άη»“ζž„ε¦‚δΈ‹οΌš

```shell
|----mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1
| |----sdk
|----mmdeploy-1.0.0-linux-x86_64-cxx11abi
| |----README.md
| |----rtmpose-ort
| | |----rtmdet-nano
| | |----rtmpose-m
Expand All @@ -82,7 +82,7 @@ bash install_posetracker_linux.sh
```shell
# η”Ÿζˆιͺ¨ζžΆε›Ύη‰‡
bash mmpose_style_skeleton.sh \
mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1/rtmpose-ort/000000147979.jpg
mmdeploy-1.0.0-linux-x86_64-cxx11abi/rtmpose-ort/000000147979.jpg
```

ζ›΄ε€šθ―¦η»†δΏ‘ζ―ε―δ»₯ζŸ₯ηœ‹ [RTMPose](../rtmpose/README_CN.md)。
Expand Down
15 changes: 6 additions & 9 deletions projects/mmpose4aigc/install_posetracker_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@
# Copyright (c) OpenMMLab. All rights reserved.

# Download pre-compiled files
wget https://github.com/open-mmlab/mmdeploy/releases/download/v1.0.0rc3/mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1.tar.gz
wget https://github.com/open-mmlab/mmdeploy/releases/download/v1.0.0/mmdeploy-1.0.0-linux-x86_64-cxx11abi.tar.gz

# Unzip files
tar -xzvf mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1.tar.gz
tar -xzvf mmdeploy-1.0.0-linux-x86_64-cxx11abi.tar.gz

# Go to the sdk folder
cd mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1/sdk
cd mmdeploy-1.0.0-linux-x86_64-cxx11abi

# Init environment
source env.sh
source set_env.sh

# If opencv 3+ is not installed on your system, execute the following command.
# If it is installed, skip this command
bash opencv.sh
bash install_opencv.sh

# Compile executable programs
bash build.sh

# Go to mmdeploy folder
cd ../
bash build_sdk.sh

# Download models
wget https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmpose-cpu.zip
Expand Down
10 changes: 5 additions & 5 deletions projects/mmpose4aigc/mmpose_style_skeleton.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash
# Copyright (c) OpenMMLab. All rights reserved.

WORKSPACE=mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1/sdk/
WORKSPACE=mmdeploy-1.0.0-linux-x86_64-cxx11abi
export LD_LIBRARY_PATH=${WORKSPACE}/lib:${WORKSPACE}/thirdparty/onnxruntime/lib:$LD_LIBRARY_PATH

INPUT_IMAGE=$1

mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1/sdk/bin/pose_tracker \
mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1//rtmpose-ort/rtmdet-nano \
mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1//rtmpose-ort/rtmpose-m \
${WORKSPACE}/bin/pose_tracker \
${WORKSPACE}/rtmpose-ort/rtmdet-nano \
${WORKSPACE}/rtmpose-ort/rtmpose-m \
$INPUT_IMAGE \
--background black \
--skeleton mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1//rtmpose-ort/t2i-adapter_skeleton.txt \
--skeleton ${WORKSPACE}/rtmpose-ort/t2i-adapter_skeleton.txt \
--output ./skeleton_res.jpg \
--pose_kpt_thr 0.4 \
--show -1
100 changes: 50 additions & 50 deletions projects/rtmpose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ We provide the UDP pretraining configs of the CSPNeXt backbone. Find more detail
| CSPNeXt-m | 256x192 | 13.05 | 3.06 | 74.8 | 77.7 | [Model](https://download.openmmlab.com/mmpose/v1/projects/rtmpose/cspnext-m_udp-aic-coco_210e-256x192-f2f7d6f6_20230130.pth) |
| CSPNeXt-l | 256x192 | 32.44 | 5.33 | 77.2 | 79.9 | [Model](https://download.openmmlab.com/mmpose/v1/projects/rtmpose/cspnext-l_udp-aic-coco_210e-256x192-273b7631_20230130.pth) |

We also provide the ImageNet classification pre-trained weights of the CSPNeXt backbone. Find more details in [RTMDet](https://github.com/open-mmlab/mmdetection/blob/dev-3.x/configs/rtmdet/README.md#classification).
We also provide the ImageNet classification pre-trained weights of the CSPNeXt backbone. Find more details in [RTMDet](https://github.com/open-mmlab/mmdetection/blob/latest/configs/rtmdet/README.md#classification).

| Model | Input Size | Params(M) | Flops(G) | Top-1 (%) | Top-5 (%) | Download |
| :----------: | :--------: | :-------: | :------: | :-------: | :-------: | :---------------------------------------------------------------------------------------------------------------------------------: |
Expand Down Expand Up @@ -249,23 +249,23 @@ Env Requirements:

```shell
# Download pre-compiled files
wget https://github.com/open-mmlab/mmdeploy/releases/download/v1.0.0rc3/mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1.tar.gz
wget https://github.com/open-mmlab/mmdeploy/releases/download/v1.0.0/mmdeploy-1.0.0-linux-x86_64-cxx11abi.tar.gz

# Unzip files
tar -xzvf mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1.tar.gz
tar -xzvf mmdeploy-1.0.0-linux-x86_64-cxx11abi.tar.gz

# Go to the sdk folder
cd mmdeploy-1.0.0rc3-linux-x86_64-onnxruntime1.8.1/sdk
cd mmdeploy-1.0.0-linux-x86_64-cxx11abi

# Init environment
source env.sh
source set_env.sh

# If opencv 3+ is not installed on your system, execute the following command.
# If it is installed, skip this command
bash opencv.sh
bash install_opencv.sh

# Compile executable programs
bash build.sh
bash build_sdk.sh

# Inference for an image
# Please pass the folder of the model, not the model file
Expand All @@ -280,23 +280,23 @@ bash build.sh

```shell
# Download pre-compiled files
wget https://github.com/open-mmlab/mmdeploy/releases/download/v1.0.0rc3/mmdeploy-1.0.0rc3-linux-x86_64-cuda11.1-tensorrt8.2.3.0.tar.gz
wget https://github.com/open-mmlab/mmdeploy/releases/download/v1.0.0/mmdeploy-1.0.0-linux-x86_64-cxx11abi-cuda11.3.tar.gz

# Unzip files
tar -xzvf mmdeploy-1.0.0rc3-linux-x86_64-cuda11.1-tensorrt8.2.3.0.tar.gz
tar -xzvf mmdeploy-1.0.0-linux-x86_64-cxx11abi-cuda11.3.tar.gz

# Go to the sdk folder
cd mmdeploy-1.0.0rc3-linux-x86_64-cuda11.1-tensorrt8.2.3.0/sdk
cd mmdeploy-1.0.0-linux-x86_64-cxx11abi-cuda11.3

# Init environment
source env.sh
source set_env.sh

# If opencv 3+ is not installed on your system, execute the following command.
# If it is installed, skip this command
bash opencv.sh
bash install_opencv.sh

# Compile executable programs
bash build.sh
bash build_sdk.sh

# Inference for an image
# Please pass the folder of the model, not the model file
Expand All @@ -313,23 +313,23 @@ For details, see [Pipeline Inference](#-step4-pipeline-inference).

##### Python Inference

1. Download the [pre-compiled SDK](https://github.com/open-mmlab/mmdeploy/releases).
2. Unzip the SDK and go to the `sdk/python` folder.
3. Install `mmdeploy_python` via `.whl` file.
1. Install mmdeploy_runtime or mmdeploy_runtime_gpu

```shell
pip install {file_name}.whl
```
# for onnxruntime
pip install mmdeploy-runtime
# download [sdk](https://github.com/open-mmlab/mmdeploy/releases/download/v1.0.0/mmdeploy-1.0.0-windows-amd64.zip) add third party runtime libraries to the PATH
4. Download the [sdk models](https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmpose-cpu.zip) and unzip.
5. Inference with `pose_tracker.py`:

**Note:**
# for onnxruntime-gpu / tensorrt
pip install mmdeploy-runtime-gpu
# download [sdk](https://github.com/open-mmlab/mmdeploy/releases/download/v1.0.0/mmdeploy-1.0.0-windows-amd64.zip) add third party runtime libraries to the PATH
```

- If you meet `ImportError: DLL load failed while importing mmdeploy_python`, please copy `thirdparty/onnxruntime/lib/onnxruntime.dll` to `site-packages/mmdeploy_python/` of your current Python env.
2. Download the [sdk models](https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmpose-cpu.zip) and unzip.
3. Inference with `pose_tracker.py`:

```shell
# go to ./sdk/example/python
# go to ./example/python
# Please pass the folder of the model, not the model file
python pose_tracker.py cpu {det work-dir} {pose work-dir} {your_video.mp4}
```
Expand All @@ -349,22 +349,22 @@ set-ExecutionPolicy RemoteSigned

```shell
# in sdk folder:
.\opencv.ps1
.\install_opencv.ps1
```

6. Set environment variables:

```shell
# in sdk folder:
.\env.ps1
. .\set_env.ps1
```

7. Compile the SDK:

```shell
# in sdk folder:
# (if you installed opencv by .\install_opencv.ps1)
.\build.ps1
.\build_sdk.ps1
# (if you installed opencv yourself)
.\build_sdk.ps1 "path/to/folder/of/OpenCVConfig.cmake"
```
Expand Down Expand Up @@ -415,38 +415,38 @@ Please refer to [Train and Test](https://mmpose.readthedocs.io/en/latest/user_gu

## πŸ—οΈ How to Deploy [πŸ”](#-table-of-contents)

Here is a basic example of deploy RTMPose with [MMDeploy-1.x](https://github.com/open-mmlab/mmdeploy/tree/1.x).
Here is a basic example of deploy RTMPose with [MMDeploy](https://github.com/open-mmlab/mmdeploy/tree/main).

### 🧩 Step1. Install MMDeploy

Before starting the deployment, please make sure you install MMPose-1.x and MMDeploy-1.x correctly.
Before starting the deployment, please make sure you install MMPose and MMDeploy correctly.

- Install MMPose-1.x, please refer to the [MMPose-1.x installation guide](https://mmpose.readthedocs.io/en/latest/installation.html).
- Install MMDeploy-1.x, please refer to the [MMDeploy-1.x installation guide](https://mmdeploy.readthedocs.io/en/1.x/get_started.html#installation).
- Install MMPose, please refer to the [MMPose installation guide](https://mmpose.readthedocs.io/en/latest/installation.html).
- Install MMDeploy, please refer to the [MMDeploy installation guide](https://mmdeploy.readthedocs.io/en/latest/get_started.html#installation).

Depending on the deployment backend, some backends require compilation of custom operators, so please refer to the corresponding document to ensure the environment is built correctly according to your needs:

- [ONNX RUNTIME SUPPORT](https://mmdeploy.readthedocs.io/en/1.x/05-supported-backends/onnxruntime.html)
- [TENSORRT SUPPORT](https://mmdeploy.readthedocs.io/en/1.x/05-supported-backends/tensorrt.html)
- [OPENVINO SUPPORT](https://mmdeploy.readthedocs.io/en/1.x/05-supported-backends/openvino.html)
- [More](https://github.com/open-mmlab/mmdeploy/tree/1.x/docs/en/05-supported-backends)
- [ONNX RUNTIME SUPPORT](https://mmdeploy.readthedocs.io/en/latest/05-supported-backends/onnxruntime.html)
- [TENSORRT SUPPORT](https://mmdeploy.readthedocs.io/en/latest/05-supported-backends/tensorrt.html)
- [OPENVINO SUPPORT](https://mmdeploy.readthedocs.io/en/latest/05-supported-backends/openvino.html)
- [More](https://github.com/open-mmlab/mmdeploy/tree/main/docs/en/05-supported-backends)

### πŸ› οΈ Step2. Convert Model

After the installation, you can enjoy the model deployment journey starting from converting PyTorch model to backend model by running MMDeploy's `tools/deploy.py`.

The detailed model conversion tutorial please refer to the [MMDeploy document](https://mmdeploy.readthedocs.io/en/1.x/02-how-to-run/convert_model.html). Here we only give the example of converting RTMPose.
The detailed model conversion tutorial please refer to the [MMDeploy document](https://mmdeploy.readthedocs.io/en/latest/02-how-to-run/convert_model.html). Here we only give the example of converting RTMPose.

Here we take converting RTMDet-nano and RTMPose-m to ONNX/TensorRT as an example.

- If you only want to use ONNX, please use:
- [`detection_onnxruntime_static.py`](https://github.com/open-mmlab/mmdeploy/blob/1.x/configs/mmdet/detection/detection_onnxruntime_static.py) for RTMDet.
- [`pose-detection_simcc_onnxruntime_dynamic.py`](https://github.com/open-mmlab/mmdeploy/blob/1.x/configs/mmpose/pose-detection_simcc_onnxruntime_dynamic.py) for RTMPose.
- [`detection_onnxruntime_static.py`](https://github.com/open-mmlab/mmdeploy/blob/main/configs/mmdet/detection/detection_onnxruntime_static.py) for RTMDet.
- [`pose-detection_simcc_onnxruntime_dynamic.py`](https://github.com/open-mmlab/mmdeploy/blob/main/configs/mmpose/pose-detection_simcc_onnxruntime_dynamic.py) for RTMPose.
- If you want to use TensorRT, please use:
- [`detection_tensorrt_static-320x320.py`](https://github.com/open-mmlab/mmdeploy/blob/1.x/configs/mmdet/detection/detection_tensorrt_static-320x320.py) for RTMDet.
- [`pose-detection_simcc_tensorrt_dynamic-256x192.py`](https://github.com/open-mmlab/mmdeploy/blob/1.x/configs/mmpose/pose-detection_simcc_tensorrt_dynamic-256x192.py) for RTMPose.
- [`detection_tensorrt_static-320x320.py`](https://github.com/open-mmlab/mmdeploy/blob/main/configs/mmdet/detection/detection_tensorrt_static-320x320.py) for RTMDet.
- [`pose-detection_simcc_tensorrt_dynamic-256x192.py`](https://github.com/open-mmlab/mmdeploy/blob/main/configs/mmpose/pose-detection_simcc_tensorrt_dynamic-256x192.py) for RTMPose.

If you want to customize the settings in the deployment config for your requirements, please refer to [MMDeploy config tutorial](https://mmdeploy.readthedocs.io/en/1.x/02-how-to-run/write_config.html).
If you want to customize the settings in the deployment config for your requirements, please refer to [MMDeploy config tutorial](https://mmdeploy.readthedocs.io/en/latest/02-how-to-run/write_config.html).

In this tutorial, we organize files as follows:

Expand Down Expand Up @@ -587,7 +587,7 @@ import argparse

import cv2
import numpy as np
from mmdeploy_python import PoseDetector
from mmdeploy_runtime import PoseDetector


def parse_args():
Expand Down Expand Up @@ -701,8 +701,8 @@ target_link_libraries(${name} PRIVATE mmdeploy ${OpenCV_LIBS})

#### Other languages

- [C# API Examples](https://github.com/open-mmlab/mmdeploy/tree/1.x/demo/csharp)
- [JAVA API Examples](https://github.com/open-mmlab/mmdeploy/tree/1.x/demo/java)
- [C# API Examples](https://github.com/open-mmlab/mmdeploy/tree/main/demo/csharp)
- [JAVA API Examples](https://github.com/open-mmlab/mmdeploy/tree/main/demo/java)

## πŸš€ Step4. Pipeline Inference

Expand Down Expand Up @@ -736,8 +736,8 @@ optional arguments:

#### API Example

- [`det_pose.py`](https://github.com/open-mmlab/mmdeploy/blob/dev-1.x/demo/python/det_pose.py)
- [`det_pose.cxx`](https://github.com/open-mmlab/mmdeploy/blob/dev-1.x/demo/csrc/cpp/det_pose.cxx)
- [`det_pose.py`](https://github.com/open-mmlab/mmdeploy/blob/main/demo/python/det_pose.py)
- [`det_pose.cxx`](https://github.com/open-mmlab/mmdeploy/blob/main/demo/csrc/cpp/det_pose.cxx)

### Inference for a video

Expand Down Expand Up @@ -792,8 +792,8 @@ optional arguments:

#### API Example

- [`pose_tracker.py`](https://github.com/open-mmlab/mmdeploy/blob/dev-1.x/demo/python/pose_tracker.py)
- [`pose_tracker.cxx`](https://github.com/open-mmlab/mmdeploy/blob/dev-1.x/demo/csrc/cpp/pose_tracker.cxx)
- [`pose_tracker.py`](https://github.com/open-mmlab/mmdeploy/blob/main/demo/python/pose_tracker.py)
- [`pose_tracker.cxx`](https://github.com/open-mmlab/mmdeploy/blob/main/demo/csrc/cpp/pose_tracker.cxx)

## πŸ“š Common Usage [πŸ”](#-table-of-contents)

Expand Down Expand Up @@ -846,7 +846,7 @@ The result is as follows:
+--------+------------+---------+
```

If you want to learn more details of profiler, you can refer to the [Profiler Docs](https://mmdeploy.readthedocs.io/en/1.x/02-how-to-run/useful_tools.html#profiler).
If you want to learn more details of profiler, you can refer to the [Profiler Docs](https://mmdeploy.readthedocs.io/en/latest/02-how-to-run/useful_tools.html#profiler).

### πŸ“Š Model Test [πŸ”](#-table-of-contents)

Expand All @@ -860,7 +860,7 @@ python tools/test.py \
--device cpu
```

You can also refer to [MMDeploy Docs](https://github.com/open-mmlab/mmdeploy/blob/dev-1.x/docs/en/02-how-to-run/profile_model.md) for more details.
You can also refer to [MMDeploy Docs](https://github.com/open-mmlab/mmdeploy/blob/main/docs/en/02-how-to-run/profile_model.md) for more details.

## πŸ“œ Citation [πŸ”](#-table-of-contents)

Expand Down
Loading

0 comments on commit 102f49c

Please sign in to comment.