Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update readme v0_4 #763

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ MindOCR is an open-source toolbox for OCR development and application based on [
The following is the corresponding `mindocr` versions and supported
mindspore versions.

| mindocr | mindspore |
|:-------:|:---------:|
| master | master |
| 0.4 | 2.3.0 |
| 0.3 | 2.2.10 |
| 0.1 | 1.8 |
| mindocr | mindspore |
|:-------:|:-----------:|
| master | master |
| 0.4 | 2.3.1/2.3.0 |
| 0.3 | 2.2.10 |
| 0.1 | 1.8 |


## Installation
Expand Down
14 changes: 8 additions & 6 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ MindOCR是一个基于[MindSpore](https://www.mindspore.cn/en) 框架开发的OC

以下是对应的“mindocr”版本和支持 Mindspore 版本。

| mindocr | mindspore |
|:-------:|:---------:|
| master | master |
| 0.4 | 2.3.0 |
| 0.3 | 2.2.10 |
| 0.1 | 1.8 |

| mindocr | mindspore |
|:-------:|:-----------:|
| master | master |
| 0.4 | 2.3.1/2.3.0 |
| 0.3 | 2.2.10 |
| 0.1 | 1.8 |



## 安装教程
Expand Down
100 changes: 54 additions & 46 deletions configs/det/dbnet/README.md

Large diffs are not rendered by default.

104 changes: 55 additions & 49 deletions configs/det/dbnet/README_CN.md

Large diffs are not rendered by default.

78 changes: 42 additions & 36 deletions configs/rec/crnn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,53 +33,58 @@ Table Format:
- Download: url of the pretrained model weights. Use absolute url path.
-->

### Requirements

| mindspore | ascend driver | firmware | cann toolkit/kernel
|:----------|:--- | :-- |:--
| 2.3.1 | 24.1.RC2 | 7.3.0.1.231 | 8.0.RC2.beta1

### Training Perf.

According to our experiments, the training (following the steps in [Model Training](#32-model-training)) performance and evaluation (following the steps in [Model Evaluation](#33-model-evaluation)) accuracy are as follows:

<details>
<summary>Performance tested on ascend 910 with graph mode</summary>
#### Experiments are tested on ascend 910 with mindspore 2.3.1 graph mode

<div align="center">

| **model name** | **backbone** | **train dataset** | **params(M)** | **cards** | **batch size** | **jit level** | **graph compile** | **ms/step** | **img/s** | **accuracy** | **recipe** | **weight** |
|:--------------:|:---------:|:--------------:|:-------------:|:-----------------:|:----------------:|:---------------------:|:-------:|:-----------:|:---------:|:---------------------:|:-------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| CRNN | VGG7 | MJ+ST | 8.72 | 8 | 16 | O2| 67.18 s | 22.06 | 5802.71 | 82.03% | [yaml](https://github.com/mindspore-lab/mindocr/blob/main/configs/rec/crnn/crnn_vgg7.yaml) | [ckpt](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_vgg7-ea7e996c.ckpt) \| [mindir](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_vgg7-ea7e996c-573dbd61.mindir) |
| CRNN | ResNet34_vd | MJ+ST | 24.48 | 8 | 64 | O2| 201.54 s | 76.48 | 6694.84 | 84.45% | [yaml](https://github.com/mindspore-lab/mindocr/blob/main/configs/rec/crnn/crnn_resnet34.yaml) | [ckpt](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_resnet34-83f37f07.ckpt) \| [mindir](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_resnet34-83f37f07-eb10a0c9.mindir) |
</div>

- Detailed accuracy results for each benchmark dataset (IC03, IC13, IC15, IIIT, SVT, SVTP, CUTE):
<div align="center">

| **Model** | **Device Card** | **Backbone** | **Train Dataset** | **Model Params** | **Batch size per card** | **Graph train 8P (s/epoch)** | **Graph train 8P (ms/step)** | **Graph train 8P (FPS)** | **Avg Eval Accuracy** | **Recipe** | **Download** |
| :-----: |:----------:| :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: |
| CRNN | 8P | VGG7 | MJ+ST | 8.72 M | 16 | 2488.82 | 22.06 | 5802.71 | 82.03% | [yaml](https://github.com/mindspore-lab/mindocr/blob/main/configs/rec/crnn/crnn_vgg7.yaml) | [ckpt](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_vgg7-ea7e996c.ckpt) \| [mindir](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_vgg7-ea7e996c-573dbd61.mindir) |
| CRNN | 8P | ResNet34_vd | MJ+ST | 24.48 M | 64 | 2157.18 | 76.48 | 6694.84 | 84.45% | [yaml](https://github.com/mindspore-lab/mindocr/blob/main/configs/rec/crnn/crnn_resnet34.yaml) | [ckpt](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_resnet34-83f37f07.ckpt) \| [mindir](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_resnet34-83f37f07-eb10a0c9.mindir) |
| **model name** | **backbone** | **cards** | **IC03_860** | **IC03_867** | **IC13_857** | **IC13_1015** | **IC15_1811** | **IC15_2077** | **IIIT5k_3000** | **SVT** | **SVTP** | **CUTE80** | **average** |
|:--------------:| :------: |:------------:|:------------:| :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: |:-----------:|
| CRNN | VGG7 |1| 94.53% | 94.00% | 92.18% | 90.74% | 71.95% | 66.06% | 84.10% | 83.93% | 73.33% | 69.44% | 82.03% |
| CRNN | ResNet34_vd |1| 94.42% | 94.23% | 93.35% | 92.02% | 75.92% | 70.15% | 87.73% | 86.40% | 76.28% | 73.96% | 84.45% |
</div>

- Detailed accuracy results for each benchmark dataset (IC03, IC13, IC15, IIIT, SVT, SVTP, CUTE):
<div align="center">

| **Model** | **Backbone** | **IC03_860** | **IC03_867** | **IC13_857** | **IC13_1015** | **IC15_1811** | **IC15_2077** | **IIIT5k_3000** | **SVT** | **SVTP** | **CUTE80** | **Average** |
| :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: |
| CRNN | VGG7 | 94.53% | 94.00% | 92.18% | 90.74% | 71.95% | 66.06% | 84.10% | 83.93% | 73.33% | 69.44% | 82.03% |
| CRNN | ResNet34_vd | 94.42% | 94.23% | 93.35% | 92.02% | 75.92% | 70.15% | 87.73% | 86.40% | 76.28% | 73.96% | 84.45% |
</div>
</details>

#### Experiments are tested on ascend 910* with mindspore 2.3.1 graph mode
<div align="center">

<details>
<summary>Performance tested on ascend 910* with graph mode</summary>
<div align="center">
| **model name** | **backbone** | **train dataset** | **params(M)** | **cards** | **batch size** | **jit level** | **graph compile** | **ms/step** | **img/s** | **accuracy** |**recipe** | **weight** |
|:--------------:|:---------:|:--------------:|:-------------:|:-----------------:|:----------------:|:---------------------:|:----------------------------:|:-----------:|:---------:|:---------------------:|:------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|
| CRNN | VGG7 | MJ+ST | 8.72 | 8 | 16 | O2 | 94.36 s | 14.76 | 8672.09 | 81.31% | [yaml](https://github.com/mindspore-lab/mindocr/blob/main/configs/rec/crnn/crnn_vgg7.yaml) | [ckpt](https://download-mindspore.osinfra.cn/toolkits/mindocr/crnn/crnn_vgg7-6faf1b2d-910v2.ckpt) |
</div>

| **Model** | **Device Card** | **Backbone** | **Train Dataset** | **Model Params** | **Batch size per card** | **Graph train 8P (s/epoch)** | **Graph train 8P (ms/step)** | **Graph train 8P (FPS)** | **Avg Eval Accuracy** | **Recipe** | **Download** |
| :-----: |:---------------:| :-----: | :-----: | :-----: | :-----: | :-----: |:----------------------------:|:------------------------:|:---------------------:| :-----: | :-----: |
| CRNN | 8P | VGG7 | MJ+ST | 8.72 M | 16 | 2488.82 | 14.76 | 8672.09 | 81.31% | [yaml](https://github.com/mindspore-lab/mindocr/blob/main/configs/rec/crnn/crnn_vgg7.yaml) | [ckpt](https://download-mindspore.osinfra.cn/toolkits/mindocr/crnn/crnn_vgg7-6faf1b2d-910v2.ckpt)|
</div>
</details>


### Inference Perf.

The inference performance is tested on Mindspore Lite, please take a look at [Mindpore Lite Inference](#6-mindspore-lite-inference) for more details.

Experiments are tested on ascend 310P with mindspore lite 2.3.1 graph mode

<div align="center">

| Device | Env | Model | Backbone | Params | Test Dataset | Batch size | Graph infer 1P (FPS) |
| :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: |
| Ascend310P | Lite2.0 | CRNN | ResNet34_vd | 24.48 M | IC15 | 1 | 361.09 |
| Ascend310P | Lite2.0 | CRNN | ResNet34_vd | 24.48 M | SVT | 1 | 274.67 |
| model name | backbone | test dataset | params(M) | cards | batch size | **jit level** | **graph compile** | img/s |
|:----------:|:----------:|:-----:|:---------:|:-------:|:------------:|:------:|:-----------------:|:------:|
| CRNN | ResNet34_vd | IC15 | 24.48 | 1 | 1 | O2 | 10.46 s | 361.09 |
| CRNN | ResNet34_vd | SVT | 24.48 | 1 | 1 | O2 | 10.31 s | 274.67 |

</div>

Expand Down Expand Up @@ -302,7 +307,7 @@ eval:
```

**Notes:**
- As the global batch size (batch_size x num_devices) is important for reproducing the result, please adjust `batch_size` accordingly to keep the global batch size unchanged for a different number of GPUs/NPUs, or adjust the learning rate linearly to a new global batch size.
- As the global batch size (batch_size x num_devices) is important for reproducing the result, please adjust `batch_size` accordingly to keep the global batch size unchanged for a different number of NPUs, or adjust the learning rate linearly to a new global batch size.


### 3.2 Model Training
Expand All @@ -313,7 +318,7 @@ eval:
It is easy to reproduce the reported results with the pre-defined training recipe. For distributed training on multiple Ascend 910 devices, please modify the configuration parameter `system.distribute` as True and run

```shell
# distributed training on multiple GPU/Ascend devices
# distributed training on multiple Ascend devices
mpirun --allow-run-as-root -n 8 python tools/train.py --config configs/rec/crnn/crnn_resnet34.yaml
```

Expand All @@ -323,7 +328,7 @@ mpirun --allow-run-as-root -n 8 python tools/train.py --config configs/rec/crnn/
If you want to train or finetune the model on a smaller dataset without distributed training, please modify the configuration parameter`system.distribute` as False and run:

```shell
# standalone training on a CPU/GPU/Ascend device
# standalone training on a CPU/Ascend device
python tools/train.py --config configs/rec/crnn/crnn_resnet34.yaml
```

Expand Down Expand Up @@ -392,11 +397,12 @@ mpirun --allow-run-as-root -n 4 python tools/train.py --config configs/rec/crnn/

After training, evaluation results on the benchmark test set are as follows, where we also provide the model config and pretrained weights.

Experiments are tested on ascend 910 with mindspore 2.3.1 graph mode
<div align="center">

| **Model** | **Language** | **Context** |**Backbone** | **Scene** | **Web** | **Document** | **Train T.** | **FPS** | **Recipe** | **Download** |
| :-----: | :-----: | :--------: | :--------: | :--------: | :--------: | :--------: | :---------: | :--------: | :---------: | :-----------: |
| CRNN | Chinese | D910x4-MS1.10-G | ResNet34_vd | 60.45% | 65.95% | 97.68% | 647 s/epoch | 1180 | [crnn_resnet34_ch.yaml](https://github.com/mindspore-lab/mindocr/blob/main/configs/rec/crnn/crnn_resnet34_ch.yaml) | [ckpt](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_resnet34_ch-7a342e3c.ckpt) \| [mindir](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_resnet34_ch-7a342e3c-105bccb2.mindir) |
| **model name** | **backbone** | **cards** | **batch size** | **language** | **jit level** | **graph compile** | **ms/step** | **img/s** | **scene** | **web** | **document** | **recipe** | **weight** |
|:--------------:|:------------:|:--------------:|:-----------------:|:------------:|:---------:|:-----------------:|:---------:|:-------:|:------------:|:-----------:|:---------:|:------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| CRNN | ResNet34_vd | 4| 256| Chinese | O2 | 203.48 s | 38.01 | 1180 | 60.45% | 65.95% | 97.68% | [crnn_resnet34_ch.yaml](https://github.com/mindspore-lab/mindocr/blob/main/configs/rec/crnn/crnn_resnet34_ch.yaml) | [ckpt](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_resnet34_ch-7a342e3c.ckpt) \| [mindir](https://download.mindspore.cn/toolkits/mindocr/crnn/crnn_resnet34_ch-7a342e3c-105bccb2.mindir) |
</div>

**Notes:**
Expand All @@ -412,7 +418,7 @@ To inference with MindSpot Lite on Ascend 310, please refer to the tutorial [Min

**1. Model Export**

Please [download](#2-results) the exported MindIR file first, or refer to the [Model Export](../../README.md) tutorial and use the following command to export the trained ckpt model to MindIR file:
Please [download](#2-results) the exported MindIR file first, or refer to the [Model Export](../../../docs/en/inference/convert_tutorial.md#1-model-export) tutorial and use the following command to export the trained ckpt model to MindIR file:

```shell
python tools/export.py --model_name_or_config crnn_resnet34 --data_shape 32 100 --local_ckpt_path /path/to/local_ckpt.ckpt
Expand All @@ -425,11 +431,11 @@ The `data_shape` is the model input shape of height and width for MindIR file. T

**2. Environment Installation**

Please refer to [Environment Installation](../../../docs/en/inference/environment.md#2-mindspore-lite-inference) tutorial to configure the MindSpore Lite inference environment.
Please refer to [Environment Installation](../../../docs/en/inference/environment.md) tutorial to configure the MindSpore Lite inference environment.

**3. Model Conversion**

Please refer to [Model Conversion](../../../docs/en/inference/convert_tutorial.md#1-mindocr-models),
Please refer to [Model Conversion](../../../docs/en/inference/convert_tutorial.md#2-mindspore-lite-mindir-convert),
and use the `converter_lite` tool for offline conversion of the MindIR file.

**4. Inference**
Expand Down
Loading
Loading