From 180500d76df65c291745797a45b89629a35fe4fe Mon Sep 17 00:00:00 2001 From: "q.yao" Date: Thu, 10 Nov 2022 11:29:16 +0800 Subject: [PATCH] [Docs] update 1.x doc links (#1331) * update 1.x links * update docs --- docs/en/01-how-to-build/android.md | 3 +-- docs/en/01-how-to-build/build_from_source.md | 2 +- docs/en/01-how-to-build/jetsons.md | 10 +++++----- docs/en/01-how-to-build/linux-x86_64.md | 11 +++++------ docs/en/01-how-to-build/macos-arm64.md | 5 +++-- docs/en/01-how-to-build/rockchip.md | 6 +++--- docs/en/01-how-to-build/snpe.md | 2 +- docs/en/01-how-to-build/windows.md | 11 +++++------ docs/en/02-how-to-run/convert_model.md | 6 +++--- docs/en/02-how-to-run/prebuilt_package_windows.md | 6 +++--- docs/en/02-how-to-run/write_config.md | 2 +- docs/en/07-developer-guide/partition_model.md | 6 +++--- docs/zh_cn/01-how-to-build/android.md | 3 +-- docs/zh_cn/01-how-to-build/build_from_source.md | 2 +- docs/zh_cn/01-how-to-build/jetsons.md | 5 ++--- docs/zh_cn/01-how-to-build/linux-x86_64.md | 13 ++++++------- docs/zh_cn/01-how-to-build/macos-arm64.md | 5 +++-- docs/zh_cn/01-how-to-build/rockchip.md | 6 +++--- docs/zh_cn/01-how-to-build/snpe.md | 2 +- docs/zh_cn/01-how-to-build/windows.md | 13 ++++++------- docs/zh_cn/02-how-to-run/convert_model.md | 6 +++--- .../zh_cn/02-how-to-run/prebuilt_package_windows.md | 6 +++--- docs/zh_cn/02-how-to-run/write_config.md | 8 +++----- docs/zh_cn/07-developer-guide/partition_model.md | 6 +++--- docs/zh_cn/07-developer-guide/support_new_model.md | 4 ++-- 25 files changed, 71 insertions(+), 78 deletions(-) diff --git a/docs/en/01-how-to-build/android.md b/docs/en/01-how-to-build/android.md index a644db205..186babba9 100644 --- a/docs/en/01-how-to-build/android.md +++ b/docs/en/01-how-to-build/android.md @@ -6,7 +6,6 @@ - [Install Dependencies](#install-dependencies) - [Install Dependencies for SDK](#install-dependencies-for-sdk) - [Build MMDeploy](#build-mmdeploy) - - [Build Options Spec](#build-options-spec) - [Build SDK and Demos](#build-sdk-and-demos) ______________________________________________________________________ @@ -98,7 +97,7 @@ make -j$(nproc) install OpenJDK It is necessary for building Java API.
- See Java API build for building tutorials. + See Java API build for building tutorials. diff --git a/docs/en/01-how-to-build/build_from_source.md b/docs/en/01-how-to-build/build_from_source.md index d9b456ed3..e3c1d6358 100644 --- a/docs/en/01-how-to-build/build_from_source.md +++ b/docs/en/01-how-to-build/build_from_source.md @@ -26,7 +26,7 @@ Note: - If it fails when `git clone` via `SSH`, you can try the `HTTPS` protocol like this: ```shell - git clone -b master https://github.com/open-mmlab/mmdeploy.git --recursive + git clone -b 1.x https://github.com/open-mmlab/mmdeploy.git --recursive ``` ## Build diff --git a/docs/en/01-how-to-build/jetsons.md b/docs/en/01-how-to-build/jetsons.md index d517a375e..7076ebd58 100644 --- a/docs/en/01-how-to-build/jetsons.md +++ b/docs/en/01-how-to-build/jetsons.md @@ -163,7 +163,7 @@ conda activate mmdeploy ```shell sudo apt-get install -y libssl-dev -git clone --branch v1.4.0 https://github.com/open-mmlab/mmcv.git +git clone --branch 2.x https://github.com/open-mmlab/mmcv.git cd mmcv MMCV_WITH_OPS=1 pip install -e . ``` @@ -223,7 +223,7 @@ It takes about 15 minutes to install ppl.cv on a Jetson Nano. So, please be pati ## Install MMDeploy ```shell -git clone --recursive https://github.com/open-mmlab/mmdeploy.git +git clone -b 1.x --recursive https://github.com/open-mmlab/mmdeploy.git cd mmdeploy export MMDEPLOY_DIR=$(pwd) ``` @@ -283,15 +283,15 @@ Before running this demo, you need to convert model files to be able to use with MMDetection is an open source object detection toolbox based on PyTorch ```shell -git clone https://github.com/open-mmlab/mmdetection.git +git clone -b 3.x https://github.com/open-mmlab/mmdetection.git cd mmdetection pip install -r requirements/build.txt pip install -v -e . # or "python setup.py develop" ``` -2. Follow [this document](https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/tutorials/how_to_convert_model.md) on how to convert model files. +1. Follow [this document](../02-how-to-run/convert_model.md) on how to convert model files. -For this example, we have used [retinanet_r18_fpn_1x_coco.py](https://github.com/open-mmlab/mmdetection/blob/master/configs/retinanet/retinanet_r18_fpn_1x_coco.py) as the model config, and [this file](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_r18_fpn_1x_coco/retinanet_r18_fpn_1x_coco_20220407_171055-614fd399.pth) as the corresponding checkpoint file. Also for deploy config, we have used [detection_tensorrt_dynamic-320x320-1344x1344.py](https://github.com/open-mmlab/mmdeploy/blob/master/configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py) +For this example, we have used [retinanet_r18_fpn_1x_coco.py](https://github.com/open-mmlab/mmdetection/blob/3.x/configs/retinanet/retinanet_r18_fpn_1x_coco.py) as the model config, and [this file](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_r18_fpn_1x_coco/retinanet_r18_fpn_1x_coco_20220407_171055-614fd399.pth) as the corresponding checkpoint file. Also for deploy config, we have used [detection_tensorrt_dynamic-320x320-1344x1344.py](https://github.com/open-mmlab/mmdeploy/blob/master/configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py) ```shell python ./tools/deploy.py \ diff --git a/docs/en/01-how-to-build/linux-x86_64.md b/docs/en/01-how-to-build/linux-x86_64.md index 5dcfbfeeb..d1920ad1e 100644 --- a/docs/en/01-how-to-build/linux-x86_64.md +++ b/docs/en/01-how-to-build/linux-x86_64.md @@ -7,10 +7,8 @@ - [Install Dependencies for SDK](#install-dependencies-for-sdk) - [Install Inference Engines for MMDeploy](#install-inference-engines-for-mmdeploy) - [Build MMDeploy](#build-mmdeploy) - - [Build Options Spec](#build-options-spec) - [Build Model Converter](#build-model-converter) - - [Build Custom Ops](#build-custom-ops) - - [Install Model Converter](#install-model-converter) + - [Install Model Converter](#install-model-converter) - [Build SDK and Demo](#build-sdk-and-demo) ______________________________________________________________________ @@ -71,12 +69,13 @@ conda install pytorch==1.8.0 torchvision==0.9.0 cudatoolkit=11.1 -c pytorch -c c - mmcv-full - Install mmcv-full as follows. Refer to the guide for details. + mmcv + Install mmcv as follows. Refer to the guide for details.

 export cu_version=cu111 # cuda 11.1
 export torch_version=torch1.8
-pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/${cu_version}/${torch_version}/index.html
+pip install -U openmim
+mim install "mmcv>=2.0.0rc1"
 
diff --git a/docs/en/01-how-to-build/macos-arm64.md b/docs/en/01-how-to-build/macos-arm64.md index 80a2199a5..bf86c6c1a 100644 --- a/docs/en/01-how-to-build/macos-arm64.md +++ b/docs/en/01-how-to-build/macos-arm64.md @@ -34,9 +34,10 @@ Please refer to [get_started](../get_started.md) to install conda. ```bash -# install pytorch & mmcv-full +# install pytorch & mmcv conda install pytorch==1.9.0 torchvision==0.10.0 -c pytorch -pip install mmcv-full==1.6.0 -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.9.0/index.html +pip install -U openmim +mim install "mmcv>=2.0.0rc1" ``` ### Install Dependencies for SDK diff --git a/docs/en/01-how-to-build/rockchip.md b/docs/en/01-how-to-build/rockchip.md index 6c22a2fbd..74b4b40d4 100644 --- a/docs/en/01-how-to-build/rockchip.md +++ b/docs/en/01-how-to-build/rockchip.md @@ -42,7 +42,7 @@ It is recommended to create a virtual environment for the project. conda install pytorch==1.8.0 torchvision==0.9.0 cudatoolkit=11.1 -c pytorch -c conda-forge ``` -To work with models from [MMClassification](https://mmclassification.readthedocs.io/en/latest/getting_started.html), you may need to install it additionally. +To work with models from [MMClassification](https://mmclassification.readthedocs.io/en/1.x/get_started.html), you may need to install it additionally. ## Usage @@ -158,7 +158,7 @@ label: 65, score: 0.95 - MMDet models. - YOLOV3 & YOLOX: you may paste the following partition configuration into [detection_rknn_static.py](https://github.com/open-mmlab/mmdeploy/blob/master/configs/mmdet/detection/detection_rknn_static.py): + YOLOV3 & YOLOX: you may paste the following partition configuration into [detection_rknn_static-320x320.py](https://github.com/open-mmlab/mmdeploy/blob/master/configs/mmdet/detection/detection_rknn_static-320x320.py): ```python # yolov3, yolox @@ -173,7 +173,7 @@ label: 65, score: 0.95 ]) ``` - RetinaNet & SSD & FSAF with rknn-toolkit2, you may paste the following partition configuration into [detection_rknn_static.py](https://github.com/open-mmlab/mmdeploy/blob/master/configs/mmdet/detection/detection_rknn_static.py). Users with rknn-toolkit can directly use default config. + RetinaNet & SSD & FSAF with rknn-toolkit2, you may paste the following partition configuration into [detection_rknn_static-320x320.py](https://github.com/open-mmlab/mmdeploy/blob/master/configs/mmdet/detection/detection_rknn_static-320x320.py). Users with rknn-toolkit can directly use default config. ```python # retinanet, ssd diff --git a/docs/en/01-how-to-build/snpe.md b/docs/en/01-how-to-build/snpe.md index 08b89cd11..f069bc64b 100644 --- a/docs/en/01-how-to-build/snpe.md +++ b/docs/en/01-how-to-build/snpe.md @@ -71,7 +71,7 @@ $ python3 -m pip install -e . ## 3. Test the model -Take Resnet-18 as an example. First refer to [documentation to install mmcls](https://github.com/open-mmlab/mmclassification) and use `tools/deploy.py` to convert the model. +Take Resnet-18 as an example. First refer to [documentation to install mmcls](https://github.com/open-mmlab/mmclassification/tree/1.x) and use `tools/deploy.py` to convert the model. ```bash $ export MODEL_CONFIG=/path/to/mmclassification/configs/resnet/resnet18_8xb16_cifar10.py diff --git a/docs/en/01-how-to-build/windows.md b/docs/en/01-how-to-build/windows.md index dfbfb7956..1c27bdc26 100644 --- a/docs/en/01-how-to-build/windows.md +++ b/docs/en/01-how-to-build/windows.md @@ -8,10 +8,8 @@ - [Install Dependencies for SDK](#install-dependencies-for-sdk) - [Install Inference Engines for MMDeploy](#install-inference-engines-for-mmdeploy) - [Build MMDeploy](#build-mmdeploy) - - [Build Options Spec](#build-options-spec) - [Build Model Converter](#build-model-converter) - - [Build Custom Ops](#build-custom-ops) - - [Install Model Converter](#install-model-converter) + - [Install Model Converter](#install-model-converter) - [Build SDK and Demos](#build-sdk-and-demos) - [Note](#note) @@ -58,12 +56,13 @@ pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f htt - mmcv-full - Install mmcv-full as follows. Refer to the guide for details. + mmcv + Install mmcv as follows. Refer to the guide for details.

 $env:cu_version="cu111"
 $env:torch_version="torch1.8.0"
-pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/${cu_version}/${torch_version}/index.html
+pip install -U openmim
+mim install "mmcv>=2.0.0rc1"
 
diff --git a/docs/en/02-how-to-run/convert_model.md b/docs/en/02-how-to-run/convert_model.md index 9884561f0..ff5b34fa4 100644 --- a/docs/en/02-how-to-run/convert_model.md +++ b/docs/en/02-how-to-run/convert_model.md @@ -11,7 +11,7 @@ Notes: ### Prerequisite 1. Install and build your target backend. You could refer to [ONNXRuntime-install](../05-supported-backends/onnxruntime.md), [TensorRT-install](../05-supported-backends/tensorrt.md), [ncnn-install](../05-supported-backends/ncnn.md), [PPLNN-install](../05-supported-backends/pplnn.md), [OpenVINO-install](../05-supported-backends/openvino.md) for more information. -2. Install and build your target codebase. You could refer to [MMClassification-install](https://github.com/open-mmlab/mmclassification/blob/master/docs/en/install.md), [MMDetection-install](https://github.com/open-mmlab/mmdetection/blob/master/docs/en/get_started.md), [MMSegmentation-install](https://github.com/open-mmlab/mmsegmentation/blob/master/docs/en/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/en/install.md). +2. Install and build your target codebase. You could refer to [MMClassification-install](https://github.com/open-mmlab/mmclassification/blob/1.x/docs/en/get_started.md#installation), [MMDetection-install](https://github.com/open-mmlab/mmdetection/blob/3.x/docs/en/get_started.md), [MMSegmentation-install](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/en/get_started.md#installation), [MMOCR-install](https://github.com/open-mmlab/mmocr/blob/1.x/docs/en/get_started/install.md), [MMEditing-install](https://github.com/open-mmlab/mmediting/blob/1.x/docs/en/2_get_started.md#installation). ### Usage @@ -55,8 +55,8 @@ python ./tools/deploy.py \ ```bash python ./tools/deploy.py \ configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py \ - $PATH_TO_MMDET/configs/yolo/yolov3_d53_mstrain-608_273e_coco.py \ - $PATH_TO_MMDET/checkpoints/yolo/yolov3_d53_mstrain-608_273e_coco.pth \ + $PATH_TO_MMDET/configs/yolo/yolov3_d53_8xb8-ms-608-273e_coco.py \ + $PATH_TO_MMDET/checkpoints/yolo/yolov3_d53_mstrain-608_273e_coco_20210518_115020-a2c3acb8.pth \ $PATH_TO_MMDET/demo/demo.jpg \ --work-dir work_dir \ --show \ diff --git a/docs/en/02-how-to-run/prebuilt_package_windows.md b/docs/en/02-how-to-run/prebuilt_package_windows.md index 9fa456476..e5224f80e 100644 --- a/docs/en/02-how-to-run/prebuilt_package_windows.md +++ b/docs/en/02-how-to-run/prebuilt_package_windows.md @@ -47,7 +47,7 @@ In order to use the prebuilt package, you need to install some third-party depen 2. Clone the mmdeploy repository ```bash - git clone https://github.com/open-mmlab/mmdeploy.git + git clone -b 1.x https://github.com/open-mmlab/mmdeploy.git ``` :point_right: The main purpose here is to use the configs, so there is no need to compile `mmdeploy`. @@ -55,14 +55,14 @@ In order to use the prebuilt package, you need to install some third-party depen 3. Install mmclassification ```bash - git clone https://github.com/open-mmlab/mmclassification.git + git clone -b 1.x https://github.com/open-mmlab/mmclassification.git cd mmclassification pip install -e . ``` 4. Prepare a PyTorch model as our example - Download the pth [resnet18_8xb32_in1k_20210831-fbbb1da6.pth](https://download.openmmlab.com/mmclassification/v0/resnet/resnet18_8xb32_in1k_20210831-fbbb1da6.pth). The corresponding config of the model is [resnet18_8xb32_in1k.py](https://github.com/open-mmlab/mmclassification/blob/master/configs/resnet/resnet18_8xb32_in1k.py) + Download the pth [resnet18_8xb32_in1k_20210831-fbbb1da6.pth](https://download.openmmlab.com/mmclassification/v0/resnet/resnet18_8xb32_in1k_20210831-fbbb1da6.pth). The corresponding config of the model is [resnet18_8xb32_in1k.py](https://github.com/open-mmlab/mmclassification/blob/1.x/configs/resnet/resnet18_8xb32_in1k.py) After the above work is done, the structure of the current working directory should be: diff --git a/docs/en/02-how-to-run/write_config.md b/docs/en/02-how-to-run/write_config.md index 5bbf152f1..686313b6d 100644 --- a/docs/en/02-how-to-run/write_config.md +++ b/docs/en/02-how-to-run/write_config.md @@ -177,4 +177,4 @@ detection_tensorrt-int8_dynamic-320x320-1344x1344.py ## 6. How to write model config -According to model's codebase, write the model config file. Model's config file is used to initialize the model, referring to [MMClassification](https://github.com/open-mmlab/mmclassification/blob/master/docs/en/tutorials/config.md), [MMDetection](https://github.com/open-mmlab/mmdetection/blob/master/docs/en/tutorials/config.md), [MMSegmentation](https://github.com/open-mmlab/mmsegmentation/blob/master/docs/en/tutorials/config.md), [MMOCR](https://github.com/open-mmlab/mmocr/blob/main/docs/en/tutorials/config.md), [MMEditing](https://github.com/open-mmlab/mmediting/blob/master/docs/en/config.md). +According to model's codebase, write the model config file. Model's config file is used to initialize the model, referring to [MMClassification](https://github.com/open-mmlab/mmclassification/blob/1.x/docs/en/user_guides/config.md), [MMDetection](https://github.com/open-mmlab/mmdetection/blob/3.x/docs/en/user_guides/config.md), [MMSegmentation](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/en/user_guides/1_config.md), [MMOCR](https://github.com/open-mmlab/mmocr/blob/1.x/docs/en/user_guides/config.md), [MMEditing](https://github.com/open-mmlab/mmediting/blob/1.x/docs/en/user_guides/1_config.md). diff --git a/docs/en/07-developer-guide/partition_model.md b/docs/en/07-developer-guide/partition_model.md index 7c981af36..96aa8b73e 100644 --- a/docs/en/07-developer-guide/partition_model.md +++ b/docs/en/07-developer-guide/partition_model.md @@ -6,7 +6,7 @@ MMDeploy supports exporting PyTorch models to partitioned onnx models. With this To support the model partition, we need to add `Mark` nodes in the ONNX model. This could be done with mmdeploy's `@mark` decorator. Note that to make the `mark` work, the marking operation should be included in a rewriting function. -At first, we would mark the model input, which could be done by marking the input tensor `img` in the `forward` method of `BaseDetector` class, which is the parent class of all detector classes. Thus we name this marking point as `detector_forward` and mark the inputs as `input`. Since there could be three outputs for detectors such as `Mask RCNN`, the outputs are marked as `dets`, `labels`, and `masks`. The following code shows the idea of adding mark functions and calling the mark functions in the rewrite. For source code, you could refer to [mmdeploy/codebase/mmdet/models/detectors/base.py](https://github.com/open-mmlab/mmdeploy/blob/86a50e343a3a45d7bc2ba3256100accc4973e71d/mmdeploy/codebase/mmdet/models/detectors/base.py) +At first, we would mark the model input, which could be done by marking the input tensor `img` in the `forward` method of `BaseDetector` class, which is the parent class of all detector classes. Thus we name this marking point as `detector_forward` and mark the inputs as `input`. Since there could be three outputs for detectors such as `Mask RCNN`, the outputs are marked as `dets`, `labels`, and `masks`. The following code shows the idea of adding mark functions and calling the mark functions in the rewrite. For source code, you could refer to [mmdeploy/codebase/mmdet/models/detectors/single_stage.py](https://github.com/open-mmlab/mmdeploy/blob/4fc8828af84281b62be143012cd9f9dafd1e7cc2/mmdeploy/codebase/mmdet/models/detectors/single_stage.py) ```python from mmdeploy.core import FUNCTION_REWRITER, mark @@ -25,7 +25,7 @@ def base_detector__forward(ctx, self, img, img_metas=None, **kwargs): return __forward_impl(...) ``` -Then, we have to mark the output feature of `YOLOV3Head`, which is the input argument `pred_maps` in `get_bboxes` method of `YOLOV3Head` class. We could add a internal function to only mark the `pred_maps` inside [`yolov3_head__get_bboxes`](https://github.com/open-mmlab/mmdeploy/blob/86a50e343a3a45d7bc2ba3256100accc4973e71d/mmdeploy/codebase/mmdet/models/dense_heads/yolo_head.py#L14) function as following. +Then, we have to mark the output feature of `YOLOV3Head`, which is the input argument `pred_maps` in `get_bboxes` method of `YOLOV3Head` class. We could add a internal function to only mark the `pred_maps` inside [`yolov3_head__get_bboxes`](https://github.com/open-mmlab/mmdeploy/blob/4fc8828af84281b62be143012cd9f9dafd1e7cc2/mmdeploy/codebase/mmdet/models/dense_heads/yolo_head.py#L16) function as following. ```python from mmdeploy.core import FUNCTION_REWRITER, mark @@ -78,7 +78,7 @@ Once we have marks of nodes and the deployment config with `parition_config` bei ```shell python tools/torch2onnx.py \ configs/mmdet/detection/yolov3_partition_onnxruntime_static.py \ -../mmdetection/configs/yolo/yolov3_d53_mstrain-608_273e_coco.py \ +../mmdetection/configs/yolo/yolov3_d53_8xb8-ms-608-273e_coco.py \ https://download.openmmlab.com/mmdetection/v2.0/yolo/yolov3_d53_mstrain-608_273e_coco/yolov3_d53_mstrain-608_273e_coco_20210518_115020-a2c3acb8.pth \ ../mmdetection/demo/demo.jpg \ --work-dir ./work-dirs/mmdet/yolov3/ort/partition diff --git a/docs/zh_cn/01-how-to-build/android.md b/docs/zh_cn/01-how-to-build/android.md index 868b79d12..6cb882554 100644 --- a/docs/zh_cn/01-how-to-build/android.md +++ b/docs/zh_cn/01-how-to-build/android.md @@ -6,7 +6,6 @@ - [安装依赖包](#安装依赖包) - [安装 MMDeploy SDK 依赖](#安装-mmdeploy-sdk-依赖) - [编译 MMDeploy](#编译-mmdeploy) - - [编译选项说明](#编译选项说明) - [编译 SDK 和 Demos](#编译-sdk-和-demos) ______________________________________________________________________ @@ -99,7 +98,7 @@ make -j$(nproc) install OpenJDK 编译Java API之前需要先准备OpenJDK开发环境
- 请参考 Java API 编译 进行构建. + 请参考 Java API 编译 进行构建. diff --git a/docs/zh_cn/01-how-to-build/build_from_source.md b/docs/zh_cn/01-how-to-build/build_from_source.md index eb2f14a17..d8397a246 100644 --- a/docs/zh_cn/01-how-to-build/build_from_source.md +++ b/docs/zh_cn/01-how-to-build/build_from_source.md @@ -27,7 +27,7 @@ git clone -b master git@github.com:open-mmlab/mmdeploy.git --recursive - 如果以 `SSH` 方式 `git clone` 代码失败,您可以尝试使用 `HTTPS` 协议下载代码: ```bash - git clone -b master https://github.com/open-mmlab/mmdeploy.git MMDeploy + git clone -b 1.x https://github.com/open-mmlab/mmdeploy.git MMDeploy cd MMDeploy git submodule update --init --recursive ``` diff --git a/docs/zh_cn/01-how-to-build/jetsons.md b/docs/zh_cn/01-how-to-build/jetsons.md index 5736ac285..e55a890b9 100644 --- a/docs/zh_cn/01-how-to-build/jetsons.md +++ b/docs/zh_cn/01-how-to-build/jetsons.md @@ -149,9 +149,8 @@ conda activate mmdeploy ```shell sudo apt-get install -y libssl-dev - git clone https://github.com/open-mmlab/mmcv.git + git clone --branch 2.x https://github.com/open-mmlab/mmcv.git cd mmcv - git checkout v1.4.0 MMCV_WITH_OPS=1 pip install -e . ``` @@ -200,7 +199,7 @@ conda activate mmdeploy ## 安装 MMDeploy ```shell -git clone --recursive https://github.com/open-mmlab/mmdeploy.git +git clone -b 1.x --recursive https://github.com/open-mmlab/mmdeploy.git cd mmdeploy export MMDEPLOY_DIR=$(pwd) ``` diff --git a/docs/zh_cn/01-how-to-build/linux-x86_64.md b/docs/zh_cn/01-how-to-build/linux-x86_64.md index f2a9f92f4..c4236bddc 100644 --- a/docs/zh_cn/01-how-to-build/linux-x86_64.md +++ b/docs/zh_cn/01-how-to-build/linux-x86_64.md @@ -8,10 +8,8 @@ - [安装 MMDeploy SDK 依赖](#安装-mmdeploy-sdk-依赖) - [安装推理引擎](#安装推理引擎) - [编译 MMDeploy](#编译-mmdeploy) - - [编译选项说明](#编译选项说明) - - [编译安装 Model Converter](#编译安装-model-converter) - - [编译自定义算子](#编译自定义算子) - - [安装 Model Converter](#安装-model-converter) + - [编译 Model Converter](#编译-model-converter) + - [安装 Model Converter](#安装-model-converter) - [编译 SDK 和 Demos](#编译-sdk-和-demos) ______________________________________________________________________ @@ -72,12 +70,13 @@ conda install pytorch==1.8.0 torchvision==0.9.0 cudatoolkit=11.1 -c pytorch -c c - mmcv-full - 参考如下命令安装 mmcv-full。更多安装方式,可查看 mmcv 官网
+ mmcv + 参考如下命令安装 mmcv。更多安装方式,可查看 mmcv 官网

 export cu_version=cu111 # cuda 11.1
 export torch_version=torch1.8
-pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/${cu_version}/${torch_version}/index.html
+pip install -U openmim
+mim install "mmcv>=2.0.0rc1"
 
diff --git a/docs/zh_cn/01-how-to-build/macos-arm64.md b/docs/zh_cn/01-how-to-build/macos-arm64.md index e2da4564b..7d0fab9e6 100644 --- a/docs/zh_cn/01-how-to-build/macos-arm64.md +++ b/docs/zh_cn/01-how-to-build/macos-arm64.md @@ -37,9 +37,10 @@ 参考[get_started](../get_started.md)文档,安装conda。 ```bash -# install pytoch & mmcv-full +# install pytoch & mmcv conda install pytorch==1.9.0 torchvision==0.10.0 -c pytorch -pip install mmcv-full==1.6.0 -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.9.0/index.html +pip install -U openmim +mim install "mmcv>=2.0.0rc1" ``` #### 安装 MMDeploy SDK 依赖 diff --git a/docs/zh_cn/01-how-to-build/rockchip.md b/docs/zh_cn/01-how-to-build/rockchip.md index 7fd36efe2..420cb3d1a 100644 --- a/docs/zh_cn/01-how-to-build/rockchip.md +++ b/docs/zh_cn/01-how-to-build/rockchip.md @@ -42,7 +42,7 @@ conda install pytorch==1.8.0 torchvision==0.9.0 cudatoolkit=11.1 -c pytorch -c conda-forge ``` -如要使用 [MMClassification](https://mmclassification.readthedocs.io/en/latest/getting_started.html), 需要用户自己安装使用。 +如要使用 [MMClassification](https://mmclassification.readthedocs.io/en/1.x/get_started.html), 需要用户自己安装使用。 ## 使用 @@ -158,7 +158,7 @@ label: 65, score: 0.95 - MMDet 模型. - YOLOV3 & YOLOX: 将下面的模型拆分配置写入到 [detection_rknn_static.py](https://github.com/open-mmlab/mmdeploy/blob/master/configs/mmdet/detection/detection_rknn_static.py): + YOLOV3 & YOLOX: 将下面的模型拆分配置写入到 [detection_rknn_static-320x320.py](https://github.com/open-mmlab/mmdeploy/blob/1.x/configs/mmdet/detection/detection_rknn_static-320x320.py): ```python # yolov3, yolox @@ -173,7 +173,7 @@ label: 65, score: 0.95 ]) ``` - RetinaNet & SSD & FSAF with rknn-toolkit2, 将下面的模型拆分配置写入到 [detection_rknn_static.py](https://github.com/open-mmlab/mmdeploy/blob/master/configs/mmdet/detection/detection_rknn_static.py)。使用 rknn-toolkit 的用户则不用。 + RetinaNet & SSD & FSAF with rknn-toolkit2, 将下面的模型拆分配置写入到 [detection_rknn_static-320x320.py](https://github.com/open-mmlab/mmdeploy/blob/1.x/configs/mmdet/detection/detection_rknn_static-320x320.py)。使用 rknn-toolkit 的用户则不用。 ```python # retinanet, ssd diff --git a/docs/zh_cn/01-how-to-build/snpe.md b/docs/zh_cn/01-how-to-build/snpe.md index a26e9bbbf..b4931b47b 100644 --- a/docs/zh_cn/01-how-to-build/snpe.md +++ b/docs/zh_cn/01-how-to-build/snpe.md @@ -75,7 +75,7 @@ tips: ## 三、测试模型 -以 Resnet-18 为例。先参照[文档安装 mmcls](https://github.com/open-mmlab/mmclassification),然后使用 `tools/deploy.py` 转换模型。 +以 Resnet-18 为例。先参照[文档安装 mmcls](https://github.com/open-mmlab/mmclassification/tree/1.x),然后使用 `tools/deploy.py` 转换模型。 ```bash $ export MODEL_CONFIG=/path/to/mmclassification/configs/resnet/resnet18_8xb16_cifar10.py diff --git a/docs/zh_cn/01-how-to-build/windows.md b/docs/zh_cn/01-how-to-build/windows.md index 2c1c1bf3a..ef3645d6b 100644 --- a/docs/zh_cn/01-how-to-build/windows.md +++ b/docs/zh_cn/01-how-to-build/windows.md @@ -8,10 +8,8 @@ - [安装 MMDeploy SDK 依赖](#安装-mmdeploy-sdk-依赖) - [安装推理引擎](#安装推理引擎) - [编译 MMDeploy](#编译-mmdeploy) - - [编译选项说明](#编译选项说明) - - [编译安装 Model Converter](#编译安装-model-converter) - - [编译自定义算子](#编译自定义算子) - - [安装 Model Converter](#安装-model-converter) + - [编译 Model Converter](#编译-model-converter) + - [安装 Model Converter](#安装-model-converter) - [编译 SDK 和 Demos](#编译-sdk-和-demos) - [注意事项](#注意事项) @@ -56,12 +54,13 @@ pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f htt - mmcv-full - 参考如下命令安装 mmcv-full。更多安装方式,可查看 mmcv 官网
+ mmcv + 参考如下命令安装 mmcv。更多安装方式,可查看 mmcv 官网

 $env:cu_version="cu111"
 $env:torch_version="torch1.8"
-pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/$env:cu_version/$env:torch_version/index.html
+pip install -U openmim
+mim install "mmcv>=2.0.0rc1"
 
diff --git a/docs/zh_cn/02-how-to-run/convert_model.md b/docs/zh_cn/02-how-to-run/convert_model.md index d8a7c82fc..9d8371bbf 100644 --- a/docs/zh_cn/02-how-to-run/convert_model.md +++ b/docs/zh_cn/02-how-to-run/convert_model.md @@ -26,7 +26,7 @@ ### 准备工作 1. 安装您的目标后端。 您可以参考 [ONNXRuntime-install](../05-supported-backends/onnxruntime.md) ,[TensorRT-install](../05-supported-backends/tensorrt.md) ,[ncnn-install](../05-supported-backends/ncnn.md) ,[PPLNN-install](../05-supported-backends/pplnn.md), [OpenVINO-install](../05-supported-backends/openvino.md)。 -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/zh_CN/latest/install.html), [MMEditing-install](https://github.com/open-mmlab/mmediting/blob/master/docs/zh_cn/install.md)。 +2. 安装您的目标代码库。 您可以参考 [MMClassification-install](https://github.com/open-mmlab/mmclassification/blob/1.x/docs/zh_CN/get_started.md#%E5%AE%89%E8%A3%85), [MMDetection-install](https://github.com/open-mmlab/mmdetection/blob/3.x/docs/zh_cn/get_started.md), [MMSegmentation-install](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/zh_cn/get_started.md#installation), [MMOCR-install](https://github.com/open-mmlab/mmocr/blob/1.x/docs/zh_cn/get_started/install.md), [MMEditing-install](https://github.com/open-mmlab/mmediting/blob/1.x/docs/en/2_get_started.md#installation)。 ### 使用方法 @@ -70,8 +70,8 @@ python ./tools/deploy.py \ ```bash python ./tools/deploy.py \ configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py \ - $PATH_TO_MMDET/configs/yolo/yolov3_d53_mstrain-608_273e_coco.py \ - $PATH_TO_MMDET/checkpoints/yolo/yolov3_d53_mstrain-608_273e_coco.pth \ + $PATH_TO_MMDET/configs/yolo/yolov3_d53_8xb8-ms-608-273e_coco.py \ + $PATH_TO_MMDET/checkpoints/yolo/yolov3_d53_mstrain-608_273e_coco_20210518_115020-a2c3acb8.pth \ $PATH_TO_MMDET/demo/demo.jpg \ --work-dir work_dir \ --show \ diff --git a/docs/zh_cn/02-how-to-run/prebuilt_package_windows.md b/docs/zh_cn/02-how-to-run/prebuilt_package_windows.md index c27f928e7..f45a592b5 100644 --- a/docs/zh_cn/02-how-to-run/prebuilt_package_windows.md +++ b/docs/zh_cn/02-how-to-run/prebuilt_package_windows.md @@ -55,7 +55,7 @@ ______________________________________________________________________ 2. 克隆mmdeploy仓库 ```bash - git clone https://github.com/open-mmlab/mmdeploy.git + git clone -b 1.x https://github.com/open-mmlab/mmdeploy.git ``` :point_right: 这里主要为了使用configs文件,所以没有加`--recursive`来下载submodule,也不需要编译`mmdeploy` @@ -63,14 +63,14 @@ ______________________________________________________________________ 3. 安装mmclassification ```bash - git clone https://github.com/open-mmlab/mmclassification.git + git clone -b 1.x https://github.com/open-mmlab/mmclassification.git cd mmclassification pip install -e . ``` 4. 准备一个PyTorch的模型文件当作我们的示例 - 这里选择了[resnet18_8xb32_in1k_20210831-fbbb1da6.pth](https://download.openmmlab.com/mmclassification/v0/resnet/resnet18_8xb32_in1k_20210831-fbbb1da6.pth),对应的训练config为[resnet18_8xb32_in1k.py](https://github.com/open-mmlab/mmclassification/blob/master/configs/resnet/resnet18_8xb32_in1k.py) + 这里选择了[resnet18_8xb32_in1k_20210831-fbbb1da6.pth](https://download.openmmlab.com/mmclassification/v0/resnet/resnet18_8xb32_in1k_20210831-fbbb1da6.pth),对应的训练config为[resnet18_8xb32_in1k.py](https://github.com/open-mmlab/mmclassification/blob/1.x/configs/resnet/resnet18_8xb32_in1k.py) 做好以上工作后,当前工作目录的结构应为: diff --git a/docs/zh_cn/02-how-to-run/write_config.md b/docs/zh_cn/02-how-to-run/write_config.md index 0aaaf7f51..51b52455f 100644 --- a/docs/zh_cn/02-how-to-run/write_config.md +++ b/docs/zh_cn/02-how-to-run/write_config.md @@ -6,7 +6,7 @@ -- [如何编写配置文件](#如何编写配置文件) +- [如何写模型转换配置](#如何写模型转换配置) - [1. 如何编写ONNX配置](#1-如何编写onnx配置) - [ONNX配置参数说明](#onnx配置参数说明) - [示例](#示例) @@ -21,8 +21,6 @@ - [5. 部署配置文件命名规则](#5-部署配置文件命名规则) - [示例](#示例-4) - [6. 如何编写模型配置文件](#6-如何编写模型配置文件) - - [7. 注意事项](#7-注意事项) - - [8. 常见问题](#8-常见问题) @@ -106,7 +104,7 @@ codebase_config = dict(type='mmcls', task='Classification') ## 3. 如何编写推理框架配置 -推理框架配置主要用于指定模型运行在哪个推理框架,并提供模型在推理框架运行时所需的信息,具体参考 [ONNX Runtime](https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/backends/onnxruntime.md), [TensorRT](https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/backends/tensorrt.md), [ncnn](https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/backends/ncnn.md), [PPLNN](https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/backends/pplnn.md)。 +推理框架配置主要用于指定模型运行在哪个推理框架,并提供模型在推理框架运行时所需的信息,具体参考 [ONNX Runtime](../05-supported-backends/onnxruntime.md), [TensorRT](../05-supported-backends/tensorrt.md), [ncnn](../05-supported-backends/ncnn.md), [PPLNN](../05-supported-backends/pplnn.md)。 - `type`: 模型推理框架, 包括 `onnxruntime`, `ncnn`, `pplnn`, `tensorrt`, `openvino`。 @@ -189,4 +187,4 @@ detection_tensorrt-int8_dynamic-320x320-1344x1344.py ## 6. 如何编写模型配置文件 -请根据模型具体任务的代码库,编写模型配置文件。 模型配置文件用于初始化模型,详情请参考[MMClassification](https://github.com/open-mmlab/mmclassification/blob/master/docs/zh_CN/tutorials/config.md),[MMDetection](https://github.com/open-mmlab/mmdetection/blob/master/docs/zh_cn/tutorials/config.md), [MMSegmentation](https://github.com/open-mmlab/mmsegmentation/blob/master/docs/zh_cn/tutorials/config.md), [MMOCR](https://github.com/open-mmlab/mmocr/blob/main/docs/en/tutorials/config.md),[MMEditing](https://github.com/open-mmlab/mmediting/blob/master/docs/zh_cn/config.md)。 +请根据模型具体任务的代码库,编写模型配置文件。 模型配置文件用于初始化模型,详情请参考[MMClassification](https://github.com/open-mmlab/mmclassification/blob/1.x/docs/zh_CN/user_guides/config.md),[MMDetection](https://github.com/open-mmlab/mmdetection/blob/3.x/docs/zh_cn/user_guides/config.md), [MMSegmentation](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/zh_cn/user_guides/1_config.md), [MMOCR](https://github.com/open-mmlab/mmocr/blob/1.x/docs/en/user_guides/config.md),[MMEditing](https://github.com/open-mmlab/mmediting/blob/1.x/docs/en/user_guides/1_config.md)。 diff --git a/docs/zh_cn/07-developer-guide/partition_model.md b/docs/zh_cn/07-developer-guide/partition_model.md index a9104173a..2356554d4 100644 --- a/docs/zh_cn/07-developer-guide/partition_model.md +++ b/docs/zh_cn/07-developer-guide/partition_model.md @@ -6,7 +6,7 @@ MMDeploy 支持将PyTorch模型导出到onnx模型并进行拆分得到多个onn 为了进行图拆分,我们定义了`Mark`类型op,标记模型导出的边界。在实现方法上,采用`mark`装饰器对函数的输入、输出`Tensor`打标记。需要注意的是,我们的标记函数需要在某个重写函数中执行才能生效。 -为了对YOLOV3进行拆分,首先我们需要标记模型的输入。这里为了通用性,我们标记检测器父类`BaseDetector`的`forward`方法中的`img` `Tensor`,同时为了支持其他拆分方案,也对`forward`函数的输出进行了标记,分别是`dets`, `labels`和`masks`。下面的代码是截图[mmdeploy/codebase/mmdet/models/detectors/base.py](https://github.com/open-mmlab/mmdeploy/blob/86a50e343a3a45d7bc2ba3256100accc4973e71d/mmdeploy/codebase/mmdet/models/detectors/base.py)中的一部分,可以看出我们使用`mark`装饰器标记了`__forward_impl`函数的输入输出,并在重写函数`base_detector__forward`进行了调用,从而完成了对检测器输入的标记。 +为了对YOLOV3进行拆分,首先我们需要标记模型的输入。这里为了通用性,我们标记检测器父类`BaseDetector`的`forward`方法中的`img` `Tensor`,同时为了支持其他拆分方案,也对`forward`函数的输出进行了标记,分别是`dets`, `labels`和`masks`。下面的代码是截图[mmdeploy/codebase/mmdet/models/detectors/single_stage.py](https://github.com/open-mmlab/mmdeploy/blob/4fc8828af84281b62be143012cd9f9dafd1e7cc2/mmdeploy/codebase/mmdet/models/detectors/single_stage.py)中的一部分,可以看出我们使用`mark`装饰器标记了`__forward_impl`函数的输入输出,并在重写函数`base_detector__forward`进行了调用,从而完成了对检测器输入的标记。 ```python from mmdeploy.core import FUNCTION_REWRITER, mark @@ -25,7 +25,7 @@ def base_detector__forward(ctx, self, img, img_metas=None, **kwargs): return __forward_impl(...) ``` -接下来,我们只需要对`YOLOV3Head`中最后一层输出特征`Tensor`进行标记就可以将整个`YOLOV3`模型拆分成两部分。通过查看`mmdet`源码我们可以知道`YOLOV3Head`的`get_bboxes`方法中输入参数`pred_maps`就是我们想要的拆分点,因此可以在重写函数[`yolov3_head__get_bboxes`](https://github.com/open-mmlab/mmdeploy/blob/86a50e343a3a45d7bc2ba3256100accc4973e71d/mmdeploy/codebase/mmdet/models/dense_heads/yolo_head.py#L14)中添加内部函数对`pred_mapes`进行标记,具体参考如下示例代码。值得注意的是,输入参数`pred_maps`是由三个`Tensor`组成的列表,所以我们在onnx模型中添加了三个`Mark`标记节点。 +接下来,我们只需要对`YOLOV3Head`中最后一层输出特征`Tensor`进行标记就可以将整个`YOLOV3`模型拆分成两部分。通过查看`mmdet`源码我们可以知道`YOLOV3Head`的`get_bboxes`方法中输入参数`pred_maps`就是我们想要的拆分点,因此可以在重写函数[`yolov3_head__get_bboxes`](https://github.com/open-mmlab/mmdeploy/blob/4fc8828af84281b62be143012cd9f9dafd1e7cc2/mmdeploy/codebase/mmdet/models/dense_heads/yolo_head.py#L16)中添加内部函数对`pred_mapes`进行标记,具体参考如下示例代码。值得注意的是,输入参数`pred_maps`是由三个`Tensor`组成的列表,所以我们在onnx模型中添加了三个`Mark`标记节点。 ```python from mmdeploy.core import FUNCTION_REWRITER, mark @@ -76,7 +76,7 @@ partition_config = dict( ```shell python tools/torch2onnx.py \ configs/mmdet/detection/yolov3_partition_onnxruntime_static.py \ -../mmdetection/configs/yolo/yolov3_d53_mstrain-608_273e_coco.py \ +../mmdetection/configs/yolo/yolov3_d53_8xb8-ms-608-273e_coco.py \ https://download.openmmlab.com/mmdetection/v2.0/yolo/yolov3_d53_mstrain-608_273e_coco/yolov3_d53_mstrain-608_273e_coco_20210518_115020-a2c3acb8.pth \ ../mmdetection/demo/demo.jpg \ --work-dir ./work-dirs/mmdet/yolov3/ort/partition diff --git a/docs/zh_cn/07-developer-guide/support_new_model.md b/docs/zh_cn/07-developer-guide/support_new_model.md index 47ab46d4e..7c9cd72ad 100644 --- a/docs/zh_cn/07-developer-guide/support_new_model.md +++ b/docs/zh_cn/07-developer-guide/support_new_model.md @@ -24,7 +24,7 @@ def repeat_static(ctx, input, *size): - `backend`是推理引擎。当模型被导入到引擎的时候,函数会被重载。如果没有给出,重载默认的参数就是重载的参数。如果后端的重载的参数不存在,将会按照预设的默认模式进行重载。 当参数与原始的参数相同时,除了把上下文信息`ctx` 作为第一的参数外,上下文也提供了一些有用的信息,例如:部署的配置`ctx.cfg` 和原始的函数(已经被重载)`ctx.origin_func`。 -可参照[这些样例代码](https://github.com/open-mmlab/mmdeploy/blob/master/mmdeploy/codebase/mmcls/models/backbones/shufflenet_v2.py)。 +可参照[这些样例代码](https://github.com/open-mmlab/mmdeploy/blob/4d8ea40f55ae9a7ab39d208870fb791de9d46bf9/mmdeploy/codebase/mmcls/models/backbones/shufflenet_v2.py)。 ## 模型重载器 @@ -87,4 +87,4 @@ def squeeze_default(ctx, g, self, dim=None): 就像函数重载器的`ctx`一样,第一个参数会提供上下文信息。上下文中了一些有用的信息,例如部署配置ctx.cfg和原始功能(已被重载)`ctx.origin_func`。请注意, `ctx.origin_func`只能在`is_pytorch==False`时使用。 -[这里](https://github.com/open-mmlab/mmdeploy/tree/master/mmdeploy/pytorch/ops)有很多实现可参考。 +[这里](https://github.com/open-mmlab/mmdeploy/tree/6420e2044515ff2052960c0f8bb9e351e6a7f2c2/mmdeploy/pytorch/symbolics)有很多实现可参考。