diff --git a/docs/en/install.md b/docs/en/install.md
index 807be8271..4e523cd4d 100644
--- a/docs/en/install.md
+++ b/docs/en/install.md
@@ -9,115 +9,82 @@
- CUDA 10.1
- NCCL 2
- GCC 5.4.0 or higher
-- [MMCV](https://mmcv.readthedocs.io/en/latest/#installation)
-- [MMDetection](https://mmdetection.readthedocs.io/en/latest/#installation)
-MMOCR has different version requirements on MMCV and MMDetection at each release to guarantee the implementation correctness. Please refer to the table below and ensure the package versions fit the requirement.
-
-| MMOCR | MMCV | MMDetection |
-| ------------ | ------------------------ | --------------------------- |
-| main | 1.3.8 \<= mmcv \<= 1.6.0 | 2.21.0 \<= mmdet \<= 3.0.0 |
-| 0.6.0 | 1.3.8 \<= mmcv \<= 1.6.0 | 2.21.0 \<= mmdet \<= 3.0.0 |
-| 0.5.0 | 1.3.8 \<= mmcv \<= 1.5.0 | 2.14.0 \<= mmdet \<= 3.0.0 |
-| 0.4.0, 0.4.1 | 1.3.8 \<= mmcv \<= 1.5.0 | 2.14.0 \<= mmdet \<= 2.20.0 |
-| 0.3.0 | 1.3.8 \<= mmcv \<= 1.4.0 | 2.14.0 \<= mmdet \<= 2.20.0 |
-| 0.2.1 | 1.3.8 \<= mmcv \<= 1.4.0 | 2.13.0 \<= mmdet \<= 2.20.0 |
-| 0.2.0 | 1.3.4 \<= mmcv \<= 1.4.0 | 2.11.0 \<= mmdet \<= 2.13.0 |
-| 0.1.0 | 1.2.6 \<= mmcv \<= 1.3.4 | 2.9.0 \<= mmdet \<= 2.11.0 |
+## Environment Setup
-We have tested the following versions of OS and software:
-
-- OS: Ubuntu 16.04
-- CUDA: 10.1
-- GCC(G++): 5.4.0
-- MMCV 1.3.8
-- MMDetection 2.14.0
-- PyTorch 1.6.0
-- torchvision 0.7.0
-
-MMOCR depends on PyTorch and mmdetection.
+```{note}
+If you are experienced with PyTorch and have already installed it, just skip this part and jump to the [next section](#installation-steps). Otherwise, you can follow these steps for the preparation.
+```
-## Step-by-Step Installation Instructions
+**Step 0.** Download and install Miniconda from the [official website](https://docs.conda.io/en/latest/miniconda.html).
-a. Create a Conda virtual environment and activate it.
+**Step 1.** Create a conda environment and activate it.
```shell
-conda create -n open-mmlab python=3.7 -y
-conda activate open-mmlab
+conda create --name openmmlab python=3.8 -y
+conda activate openmmlab
```
-b. Install PyTorch and torchvision following the [official instructions](https://pytorch.org/), e.g.,
+**Step 2.** Install PyTorch following [official instructions](https://pytorch.org/get-started/locally/), e.g.
-```shell
-conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch
-```
-
-```{note}
-Make sure that your compilation CUDA version and runtime CUDA version matches.
-You can check the supported CUDA version for precompiled packages on the [PyTorch website](https://pytorch.org/).
-```
-
-c. Install [mmcv](https://github.com/open-mmlab/mmcv), we recommend you to install the pre-build mmcv as below.
+On GPU platforms:
```shell
-pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
+conda install pytorch torchvision -c pytorch
```
-Please replace `{cu_version}` and `{torch_version}` in the url with your desired one. For example, to install the latest `mmcv-full` with CUDA 11 and PyTorch 1.7.0, use the following command:
+On CPU platforms:
```shell
-pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html
-```
-
-````{note}
-mmcv-full is only compiled on PyTorch 1.x.0 because the compatibility usually holds between 1.x.0 and 1.x.1. If your PyTorch version is 1.x.1, you can install mmcv-full compiled with PyTorch 1.x.0 and it usually works well.
-
-```bash
-# We can ignore the micro version of PyTorch
-pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7/index.html
+conda install pytorch torchvision cpuonly -c pytorch
```
-````
+## Installation Steps
-```{note}
+We recommend that users follow our best practices to install MMOCR. However, the whole process is highly customizable. See [Customize Installation](#customize-installation) section for more information.
-If it compiles during installation, then please check that the CUDA version and PyTorch version **exactly** matches the version in the `mmcv-full` installation command.
+### Best Practices
-See official [installation guide](https://github.com/open-mmlab/mmcv#installation) for different versions of MMCV compatible to different PyTorch and CUDA versions.
-```
+**Step 0.** Install [MMCV](https://github.com/open-mmlab/mmcv) using [MIM](https://github.com/open-mmlab/mim).
-```{warning}
-You need to run `pip uninstall mmcv` first if you have `mmcv` installed. If `mmcv` and `mmcv-full` are both installed, there will be `ModuleNotFoundError`.
+```shell
+pip install -U openmim
+mim install mmcv-full
```
-d. Install [mmdet](https://github.com/open-mmlab/mmdetection), we recommend you to install the latest `mmdet` with pip.
-See [here](https://pypi.org/project/mmdet/) for different versions of `mmdet`.
+**Step 1.** Install [MMDetection](https://github.com/open-mmlab/mmdetection) as a dependency.
```shell
pip install mmdet
```
-Optionally you can choose to install `mmdet` following the official installation guide \[[en](https://github.com/open-mmlab/mmdetection/blob/master/docs/en/get_started.md)/[zh_cn](https://github.com/open-mmlab/mmdetection/blob/master/docs/zh_cn/get_started.md)\].
+**Step 2.** Install MMOCR.
-e. Clone the MMOCR repository.
+Case A: If you wish to run and develop MMOCR directly, install it from source:
```shell
git clone https://github.com/open-mmlab/mmocr.git
cd mmocr
+pip install -r requirements.txt
+pip install -v -e .
+# "-v" increases pip's verbosity.
+# "-e" means installing the project in editable mode,
+# That is, any local modifications on the code will take effect immediately.
```
-f. Install build requirements and then install MMOCR.
+Case B: If you use MMOCR as a dependency or third-party package, install it with pip:
```shell
-pip install -r requirements.txt
-pip install -v -e . # or "python setup.py develop"
-export PYTHONPATH=$(pwd):$PYTHONPATH
+pip install mmocr
```
-g. (optional) If you would like to use any transform involving `albumentations` (For example, `Albu` in ABINet's pipeline):
+**Step 3. (Optional)** If you wish to use any transform involving `albumentations` (For example, `Albu` in ABINet's pipeline), install the dependency using the following command:
```shell
+# If MMOCR is installed from source
pip install -r requirements/albu.txt
+# If MMOCR is installed via pip
+pip install albumentations>=1.1.0 --no-binary qudida,albumentations
```
```{note}
@@ -130,36 +97,103 @@ to ['albumentations`'s official documentation](https://albumentations.ai/docs/ge
```
-## Full Set-up Script
+### Verify the installation
+
+We provide two options to verify the installation via inference demo, depending on your installation method. You should be able to see a pop-up image and the inference result upon successful verification.
+
+
+
+
+
+
+```bash
+# Inference result
+[{'filename': 'demo_text_det', 'text': ['yther', 'doyt', 'nan', 'heraies', '188790', 'cadets', 'army', 'ipioneered', 'and', 'icottages', 'land', 'hall', 'sgardens', 'established', 'ithis', 'preformer', 'social', 'octavial', 'hill', 'pm', 'ct', 'lof', 'aborought']}]
+```
+
+#### Case A - Installed from Source
+
+Run the following in MMOCR's directory:
+
+```bash
+python mmocr/utils/ocr.py --det DB_r18 --recog CRNN demo/demo_text_det.jpg --imshow
+```
+
+#### Case B - Installed as a Package:
-Here is the full script for setting up MMOCR with Conda.
+**Step 1.** We need to download configs, checkpoints and an image necessary for the verification.
```shell
-conda create -n open-mmlab python=3.7 -y
-conda activate open-mmlab
+mim download mmocr --config dbnet_r18_fpnc_1200e_icdar2015 --dest .
+mim download mmocr --config crnn_academic_dataset --dest .
+wget https://raw.githubusercontent.com/open-mmlab/mmocr/main/demo/demo_text_det.jpg
+```
-# install latest pytorch prebuilt with the default prebuilt CUDA version (usually the latest)
-conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch
+The downloading will take several seconds or more, depending on your network environment. The directory tree should look like the following once everything is done:
-# install the latest mmcv-full
-pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html
+```bash
+├── crnn_academic-a723a1c5.pth
+├── crnn_academic_dataset.py
+├── dbnet_r18_fpnc_1200e_icdar2015.py
+├── dbnet_r18_fpnc_sbn_1200e_icdar2015_20210329-ba3ab597.pth
+└── demo_text_det.jpg
+```
-# install mmdetection
-pip install mmdet
+**Step 2.** Run the following codes in your Python interpreter:
-# install mmocr
-git clone https://github.com/open-mmlab/mmocr.git
-cd mmocr
+```python
+from mmocr.utils.ocr import MMOCR
+ocr = MMOCR(recog='CRNN', recog_ckpt='crnn_academic-a723a1c5.pth', recog_config='crnn_academic_dataset.py', det='DB_r18', det_ckpt='dbnet_r18_fpnc_sbn_1200e_icdar2015_20210329-ba3ab597.pth', det_config='dbnet_r18_fpnc_1200e_icdar2015.py')
+ocr.readtext('demo_text_det.jpg', imshow=True)
+```
-pip install -r requirements.txt
-pip install -v -e . # or "python setup.py develop"
-export PYTHONPATH=$(pwd):$PYTHONPATH
+## Customize Installation
-# for albumentations
-pip install -r requirements/albu.txt
+### CUDA versions
+
+When installing PyTorch, you need to specify the version of CUDA. If you are not clear on which to choose, follow our recommendations:
+
+- For Ampere-based NVIDIA GPUs, such as GeForce 30 series and NVIDIA A100, CUDA 11 is a must.
+- For older NVIDIA GPUs, CUDA 11 is backward compatible, but CUDA 10.2 offers better compatibility and is more lightweight.
+
+Please make sure the GPU driver satisfies the minimum version requirements. See [this table](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions__table-cuda-toolkit-driver-versions) for more information.
+
+```{note}
+Installing CUDA runtime libraries is enough if you follow our best practices, because no CUDA code will be compiled locally. However if you hope to compile MMCV from source or develop other CUDA operators, you need to install the complete CUDA toolkit from NVIDIA's [website](https://developer.nvidia.com/cuda-downloads), and its version should match the CUDA version of PyTorch. i.e., the specified version of cudatoolkit in `conda install` command.
```
-## Another option: Docker Image
+### Install MMCV without MIM
+
+MMCV contains C++ and CUDA extensions, thus depending on PyTorch in a complex way. MIM solves such dependencies automatically and makes the installation easier. However, it is not a must.
+
+To install MMCV with pip instead of MIM, please follow [MMCV installation guides](https://mmcv.readthedocs.io/en/latest/get_started/installation.html). This requires manually specifying a find-url based on PyTorch version and its CUDA version.
+
+For example, the following command install mmcv-full built for PyTorch 1.10.x and CUDA 11.3.
+
+```shell
+pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10/index.html
+```
+
+### Install on CPU-only platforms
+
+MMOCR can be built for CPU-only environment. In CPU mode you can train (requires MMCV version >= 1.4.4), test or inference a model.
+
+However, some functionalities are gone in this mode:
+
+- Deformable Convolution
+- Modulated Deformable Convolution
+- ROI pooling
+- SyncBatchNorm
+
+If you try to train/test/inference a model containing above ops, an error will be raised.
+The following table lists affected algorithms.
+
+| Operator | Model |
+| :-----------------------------------------------------: | :-----------------------------------------------------: |
+| Deformable Convolution/Modulated Deformable Convolution | DBNet (r50dcnv2), DBNet++ (r50dcnv2), FCENet (r50dcnv2) |
+| SyncBatchNorm | PANet, PSENet |
+
+### Using MMOCR with Docker
We provide a [Dockerfile](https://github.com/open-mmlab/mmocr/blob/master/docker/Dockerfile) to build an image.
@@ -174,26 +208,17 @@ Run it with
docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/mmocr/data mmocr
```
-## Prepare Datasets
-
-It is recommended to symlink the dataset root to `mmocr/data`. Please refer to [datasets.md](datasets.md) to prepare your datasets.
-If your folder structure is different, you may need to change the corresponding paths in config files.
+## Dependency on MMCV & MMDetection
-The `mmocr` folder is organized as follows:
+MMOCR has different version requirements on MMCV and MMDetection at each release to guarantee the implementation correctness. Please refer to the table below and ensure the package versions fit the requirement.
-```
-├── configs/
-├── demo/
-├── docker/
-├── docs/
-├── LICENSE
-├── mmocr/
-├── README.md
-├── requirements/
-├── requirements.txt
-├── resources/
-├── setup.cfg
-├── setup.py
-├── tests/
-├── tools/
-```
+| MMOCR | MMCV | MMDetection |
+| ------------ | ------------------------ | --------------------------- |
+| main | 1.3.8 \<= mmcv \<= 1.7.0 | 2.21.0 \<= mmdet \<= 3.0.0 |
+| 0.6.0 | 1.3.8 \<= mmcv \<= 1.6.0 | 2.21.0 \<= mmdet \<= 3.0.0 |
+| 0.5.0 | 1.3.8 \<= mmcv \<= 1.5.0 | 2.14.0 \<= mmdet \<= 3.0.0 |
+| 0.4.0, 0.4.1 | 1.3.8 \<= mmcv \<= 1.5.0 | 2.14.0 \<= mmdet \<= 2.20.0 |
+| 0.3.0 | 1.3.8 \<= mmcv \<= 1.4.0 | 2.14.0 \<= mmdet \<= 2.20.0 |
+| 0.2.1 | 1.3.8 \<= mmcv \<= 1.4.0 | 2.13.0 \<= mmdet \<= 2.20.0 |
+| 0.2.0 | 1.3.4 \<= mmcv \<= 1.4.0 | 2.11.0 \<= mmdet \<= 2.13.0 |
+| 0.1.0 | 1.2.6 \<= mmcv \<= 1.3.4 | 2.9.0 \<= mmdet \<= 2.11.0 |
diff --git a/docs/zh_cn/install.md b/docs/zh_cn/install.md
index 23a245bf3..1cc6974b6 100644
--- a/docs/zh_cn/install.md
+++ b/docs/zh_cn/install.md
@@ -9,153 +9,192 @@
- CUDA 10.1
- NCCL 2
- GCC 5.4.0 或更高版本
-- [MMCV](https://mmcv.readthedocs.io/en/latest/#installation)
-- [MMDetection](https://mmdetection.readthedocs.io/en/latest/#installation)
-为了确保代码实现的正确性,MMOCR 每个版本都有可能改变对 MMCV 和 MMDetection 版本的依赖。请根据以下表格确保版本之间的相互匹配。
+## 准备环境
-| MMOCR | MMCV | MMDetection |
-| ------------ | ------------------------ | --------------------------- |
-| main | 1.3.8 \<= mmcv \<= 1.6.0 | 2.21.0 \<= mmdet \<= 3.0.0 |
-| 0.6.0 | 1.3.8 \<= mmcv \<= 1.6.0 | 2.21.0 \<= mmdet \<= 3.0.0 |
-| 0.5.0 | 1.3.8 \<= mmcv \<= 1.5.0 | 2.14.0 \<= mmdet \<= 3.0.0 |
-| 0.4.0, 0.4.1 | 1.3.8 \<= mmcv \<= 1.5.0 | 2.14.0 \<= mmdet \<= 2.20.0 |
-| 0.3.0 | 1.3.8 \<= mmcv \<= 1.4.0 | 2.14.0 \<= mmdet \<= 2.20.0 |
-| 0.2.1 | 1.3.8 \<= mmcv \<= 1.4.0 | 2.13.0 \<= mmdet \<= 2.20.0 |
-| 0.2.0 | 1.3.4 \<= mmcv \<= 1.4.0 | 2.11.0 \<= mmdet \<= 2.13.0 |
-| 0.1.0 | 1.2.6 \<= mmcv \<= 1.3.4 | 2.9.0 \<= mmdet \<= 2.11.0 |
+```{note}
+如果你已经在本地安装了 PyTorch,请直接跳转到[安装步骤](#安装步骤)。
+```
-我们已经测试了以下操作系统和软件版本:
+**第一步** 下载并安装 [Miniconda](https://docs.conda.io/en/latest/miniconda.html).
-- OS: Ubuntu 16.04
-- CUDA: 10.1
-- GCC(G++): 5.4.0
-- MMCV 1.3.8
-- MMDetection 2.14.0
-- PyTorch 1.6.0
-- torchvision 0.7.0
+**第二步** 创建并激活一个 conda 环境:
-MMOCR 基于 PyTorch 和 MMDetection 项目实现。
+```shell
+conda create --name openmmlab python=3.8 -y
+conda activate openmmlab
+```
-## 详细安装步骤
+**第三步** 依照[官方指南](https://pytorch.org/get-started/locally/),安装 PyTorch。
-a. 创建一个 Conda 虚拟环境并激活(open-mmlab 为自定义环境名)。
+在 GPU 平台上:
```shell
-conda create -n open-mmlab python=3.7 -y
-conda activate open-mmlab
+conda install pytorch torchvision -c pytorch
```
-b. 按照 PyTorch 官网教程安装 PyTorch 和 torchvision ([参见官方链接](https://pytorch.org/)), 例如,
+在 CPU 平台上:
```shell
-conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch
+conda install pytorch torchvision cpuonly -c pytorch
```
-```{note}
-请确定 CUDA 编译版本和运行版本一致。你可以在 [PyTorch](https://pytorch.org/) 官网检查预编译 PyTorch 所支持的 CUDA 版本。
+## 安装步骤
+
+我们建议大多数用户采用我们的推荐方式安装 MMOCR。倘若你需要更灵活的安装过程,则可以参考[自定义安装](#自定义安装)一节。
+
+### 推荐步骤
+
+**第一步** 使用 [MIM](https://github.com/open-mmlab/mim) 安装 [MMCV](https://github.com/open-mmlab/mmcv).
+
+```shell
+pip install -U openmim
+mim install mmcv-full
```
-c. 安装 [mmcv](https://github.com/open-mmlab/mmcv),推荐以下方式进行安装。
+**第二步** 将 [MMDetection](https://github.com/open-mmlab/mmdetection) 以依赖库的形式安装。
```shell
-pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
+pip install mmdet
```
-请将上述 url 中 `{cu_version}` 和 `{torch_version}`替换成你环境中对应的 CUDA 版本和 PyTorch 版本。例如,如果想要安装最新版基于 CUDA 11 和 PyTorch 1.7.0 的最新版 `mmcv-full`,请输入以下命令:
+**第三步** 安装 MMOCR.
+
+情况1: 若你需要直接运行 MMOCR 或在其基础上进行开发,则通过源码安装:
```shell
-pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html
+git clone https://github.com/open-mmlab/mmocr.git
+cd mmocr
+pip install -r requirements.txt
+pip install -v -e .
+# "-v" 会让安装过程产生更详细的输出
+# "-e" 会以可编辑的方式安装该代码库,你对该代码库所作的任何更改都会立即生效
```
-````{note}
-PyTorch 在 1.x.0 和 1.x.1 之间通常是兼容的,故 mmcv-full 只提供 1.x.0 的编译包。如果你的 PyTorch 版本是 1.x.1,你可以放心地安装在 1.x.0 版本编译的 mmcv-full。
+情况2:如果你将 MMOCR 作为一个外置依赖库使用,通过 pip 安装即可:
-```bash
-# 我们可以忽略 PyTorch 的小版本号
-pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7/index.html
+```shell
+pip install mmocr
```
-````
+**第四步(可选)** 如果你需要使用与 `albumentations` 有关的变换,比如 ABINet 数据流水线中的 `Albu`,请使用以下命令安装依赖:
+
+```shell
+# 若 MMOCR 通过源码安装
+pip install -r requirements/albu.txt
+# 若 MMOCR 通过 pip 安装
+pip install albumentations>=1.1.0 --no-binary qudida,albumentations
+```
```{note}
-如果安装时进行了编译过程,请再次确认安装的 `mmcv-full` 版本与环境中 CUDA 和 PyTorch 的版本匹配。
-如有需要,可以在[此处](https://github.com/open-mmlab/mmcv#installation)检查 mmcv 与 CUDA 和 PyTorch 的版本对应关系。
+我们建议在安装 `albumentations` 之后检查当前环境,确保 `opencv-python` 和 `opencv-python-headless` 没有同时被安装,否则有可能会产生一些无法预知的错误。如果它们不巧同时存在于环境当中,请卸载 `opencv-python-headless` 以确保 MMOCR 的可视化工具可以正常运行。
+
+查看 [`albumentations` 的官方文档](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies)以获知详情。
+
```
-```{warning}
-如果你已经安装过 `mmcv`,你需要先运行 `pip uninstall mmcv` 删除 `mmcv`,再安装 `mmcv-full`。 如果环境中同时安装了 `mmcv` 和 `mmcv-full`, 将会出现报错 `ModuleNotFoundError`。
+### 检验
+
+根据安装方式的不同,我们提供了两个可以验证安装正确性的方法。若 MMOCR 的安装无误,你在这一节完成后应当能看到以图片和文字形式表示的识别结果,示意如下:
+
+
+
+
+
+
+```bash
+# 识别结果
+[{'filename': 'demo_text_det', 'text': ['yther', 'doyt', 'nan', 'heraies', '188790', 'cadets', 'army', 'ipioneered', 'and', 'icottages', 'land', 'hall', 'sgardens', 'established', 'ithis', 'preformer', 'social', 'octavial', 'hill', 'pm', 'ct', 'lof', 'aborought']}]
```
-d. 安装 [mmdet](https://github.com/open-mmlab/mmdetection), 我们推荐使用pip安装最新版 `mmdet`。
-在 [此处](https://pypi.org/project/mmdet/) 可以查看 `mmdet` 版本信息.
+#### 若从源码安装 MMOCR
-```shell
-pip install mmdet
+在 MMOCR 的目录运行以下命令:
+
+```bash
+python mmocr/utils/ocr.py --det DB_r18 --recog CRNN demo/demo_text_det.jpg --imshow
```
-或者,你也可以按照 [安装指南](https://github.com/open-mmlab/mmdetection/blob/master/docs/get_started.md) 中的方法安装 `mmdet`。
+#### 若以包形式安装 MMOCR
-e. 克隆 MMOCR 项目到本地.
+**第一步** 下载必要的配置,权重和图片:
```shell
-git clone https://github.com/open-mmlab/mmocr.git
-cd mmocr
+mim download mmocr --config dbnet_r18_fpnc_1200e_icdar2015 --dest .
+mim download mmocr --config crnn_academic_dataset --dest .
+wget https://raw.githubusercontent.com/open-mmlab/mmocr/main/demo/demo_text_det.jpg
```
-f. 安装依赖软件环境并安装 MMOCR。
+取决于你的网络环境,下载过程可能会持续几十秒或者更长。一切就绪后,当前目录树应当包含以下文件:
-```shell
-pip install -r requirements.txt
-pip install -v -e . # or "python setup.py develop"
-export PYTHONPATH=$(pwd):$PYTHONPATH
+```bash
+├── crnn_academic-a723a1c5.pth
+├── crnn_academic_dataset.py
+├── dbnet_r18_fpnc_1200e_icdar2015.py
+├── dbnet_r18_fpnc_sbn_1200e_icdar2015_20210329-ba3ab597.pth
+└── demo_text_det.jpg
```
-g. (可选)如果你需要使用与 `albumentations` 有关的变换,比如 ABINet 数据流水线中的 `Albu`,请使用以下命令安装依赖:
+**第二步** 在 Python 解释器中运行以下代码:
-```shell
-pip install -r requirements/albu.txt
+```python
+from mmocr.utils.ocr import MMOCR
+ocr = MMOCR(recog='CRNN', recog_ckpt='crnn_academic-a723a1c5.pth', recog_config='crnn_academic_dataset.py', det='DB_r18', det_ckpt='dbnet_r18_fpnc_sbn_1200e_icdar2015_20210329-ba3ab597.pth', det_config='dbnet_r18_fpnc_1200e_icdar2015.py')
+ocr.readtext('demo_text_det.jpg', imshow=True)
```
-```{note}
+## 自定义安装
-我们建议在安装 `albumentations` 之后检查当前环境,确保 `opencv-python` 和 `opencv-python-headless` 没有同时被安装,否则有可能会产生一些无法预知的错误。如果它们不巧同时存在于环境当中,请卸载 `opencv-python-headless` 以确保 MMOCR 的可视化工具可以正常运行。
+### CUDA 版本
-查看 [`albumentations` 的官方文档](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies)以获知详情。
+安装 PyTorch 时,需要指定 CUDA 版本。如果您不清楚选择哪个,请遵循我们的建议:
+
+- 对于 Ampere 架构的 NVIDIA GPU,例如 GeForce 30 series 以及 NVIDIA A100,CUDA 11 是必需的。
+- 对于更早的 NVIDIA GPU,CUDA 11 是向前兼容的,但 CUDA 10.2 能够提供更好的兼容性,也更加轻量。
+请确保你的 GPU 驱动版本满足最低的版本需求,参阅[这张表](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions__table-cuda-toolkit-driver-versions)。
+
+```{note}
+如果按照我们的最佳实践进行安装,CUDA 运行时库就足够了,因为我们提供相关 CUDA 代码的预编译,你不需要进行本地编译。
+但如果你希望从源码进行 MMCV 的编译,或是进行其他 CUDA 算子的开发,那么就必须安装完整的 CUDA 工具链,参见
+[NVIDIA 官网](https://developer.nvidia.com/cuda-downloads),另外还需要确保该 CUDA 工具链的版本与 PyTorch 安装时
+的配置相匹配(如用 `conda install` 安装 PyTorch 时指定的 cudatoolkit 版本)。
```
-## 完整安装命令
+### 不使用 MIM 安装 MMCV
+
+MMCV 包含 C++ 和 CUDA 扩展,因此其对 PyTorch 的依赖比较复杂。MIM 会自动解析这些
+依赖,选择合适的 MMCV 预编译包,使安装更简单,但它并不是必需的。
-以下是 conda 方式安装 mmocr 的完整安装命令。
+要使用 pip 而不是 MIM 来安装 MMCV,请遵照 [MMCV 安装指南](https://mmcv.readthedocs.io/zh_CN/latest/get_started/installation.html)。
+它需要你用指定 url 的形式手动指定对应的 PyTorch 和 CUDA 版本。
+
+举个例子,如下命令将会安装基于 PyTorch 1.10.x 和 CUDA 11.3 编译的 mmcv-full。
```shell
-conda create -n open-mmlab python=3.7 -y
-conda activate open-mmlab
+pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10/index.html
+```
-# 安装最新的 PyTorch 预编译包
-conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch
+### 在 CPU 环境中安装
-# 安装最新的 mmcv-full
-pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html
+MMOCR 可以仅在 CPU 环境中安装,在 CPU 模式下,你可以完成训练(需要 MMCV 版本 >= 1.4.4)、测试和模型推理等所有操作。
-# 安装 mmdet
-pip install mmdet
+在 CPU 模式下,MMCV 中的以下算子将不可用:
-# 安装 mmocr
-git clone https://github.com/open-mmlab/mmocr.git
-cd mmocr
+- Deformable Convolution
+- Modulated Deformable Convolution
+- ROI pooling
+- SyncBatchNorm
-pip install -r requirements.txt
-pip install -v -e . # 或 "python setup.py develop"
-export PYTHONPATH=$(pwd):$PYTHONPATH
+如果你尝试使用用到了以上算子的模型进行训练、测试或推理,程序将会报错。以下为可能受到影响的模型列表:
-# 安装 albumentations
-pip install -r requirements/albu.txt
-```
+| 算子 | 模型 |
+| :-----------------------------------------------------: | :-----------------------------------------------------: |
+| Deformable Convolution/Modulated Deformable Convolution | DBNet (r50dcnv2), DBNet++ (r50dcnv2), FCENet (r50dcnv2) |
+| SyncBatchNorm | PANet, PSENet |
-## 可选方式: Docker镜像
+### 通过 Docker 使用 MMOCR
我们提供了一个 [Dockerfile](https://github.com/open-mmlab/mmocr/blob/master/docker/Dockerfile) 文件以建立 docker 镜像 。
@@ -170,26 +209,17 @@ docker build -t mmocr docker/
docker run --gpus all --shm-size=8g -it -v {实际数据目录}:/mmocr/data mmocr
```
-## 数据集准备
-
-我们推荐建立一个 symlink 路径映射,连接数据集路径到 `mmocr/data`。 详细数据集准备方法请阅读**数据集**章节。
-如果你需要的文件夹路径不同,你可能需要在 configs 文件中修改对应的文件路径信息。
+## 对 MMCV 和 MMDetection 的版本依赖
-`mmocr` 文件夹路径结构如下:
+为了确保代码实现的正确性,MMOCR 每个版本都有可能改变对 MMCV 和 MMDetection 版本的依赖。请根据以下表格确保版本之间的相互匹配。
-```
-├── configs/
-├── demo/
-├── docker/
-├── docs/
-├── LICENSE
-├── mmocr/
-├── README.md
-├── requirements/
-├── requirements.txt
-├── resources/
-├── setup.cfg
-├── setup.py
-├── tests/
-├── tools/
-```
+| MMOCR | MMCV | MMDetection |
+| ------------ | ------------------------ | --------------------------- |
+| main | 1.3.8 \<= mmcv \<= 1.7.0 | 2.21.0 \<= mmdet \<= 3.0.0 |
+| 0.6.0 | 1.3.8 \<= mmcv \<= 1.6.0 | 2.21.0 \<= mmdet \<= 3.0.0 |
+| 0.5.0 | 1.3.8 \<= mmcv \<= 1.5.0 | 2.14.0 \<= mmdet \<= 3.0.0 |
+| 0.4.0, 0.4.1 | 1.3.8 \<= mmcv \<= 1.5.0 | 2.14.0 \<= mmdet \<= 2.20.0 |
+| 0.3.0 | 1.3.8 \<= mmcv \<= 1.4.0 | 2.14.0 \<= mmdet \<= 2.20.0 |
+| 0.2.1 | 1.3.8 \<= mmcv \<= 1.4.0 | 2.13.0 \<= mmdet \<= 2.20.0 |
+| 0.2.0 | 1.3.4 \<= mmcv \<= 1.4.0 | 2.11.0 \<= mmdet \<= 2.13.0 |
+| 0.1.0 | 1.2.6 \<= mmcv \<= 1.3.4 | 2.9.0 \<= mmdet \<= 2.11.0 |
diff --git a/resources/verification.png b/resources/verification.png
new file mode 100644
index 000000000..6f0e5eb0a
Binary files /dev/null and b/resources/verification.png differ