You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: configs/rec/crnn/README.md
+71-4Lines changed: 71 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ According to our experiments, the evaluation results on public benchmark dataset
50
50
- To reproduce the result on other contexts, please ensure the global batch size is the same.
51
51
- Both VGG and ResNet models are trained from scratch without any pre-training.
52
52
- The above models are trained with MJSynth (MJ) and SynthText (ST) datasets. For more data details, please refer to [Data Preparation](#dataset-preparation)
53
-
- Evaluations are tested individually on each benchmark dataset, and Avg Accuracy is the average of accuracies across all sub-datasets.
53
+
-**Evaluations are tested individually on each benchmark dataset, and Avg Accuracy is the average of accuracies across all sub-datasets.**
54
54
- For the PaddleOCR version of CRNN, the performance is reported on the trained model provided on their [github](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_en/algorithm_rec_crnn_en.md).
55
55
56
56
@@ -66,7 +66,75 @@ Please download lmdb dataset for traininig and evaluation from [here](https://w
66
66
-`validation.zip` is the union dataset for Validation
67
67
-`evaluation.zip` contains several benchmarking datasets.
68
68
69
-
### Training
69
+
Unzip the data and after preparation, the data structure should be like
70
+
71
+
```text
72
+
.
73
+
├── train
74
+
│ ├── MJ
75
+
│ │ ├── data.mdb
76
+
│ │ ├── lock.mdb
77
+
│ ├── ST
78
+
│ │ ├── data.mdb
79
+
│ │ ├── lock.mdb
80
+
└── validation
81
+
| ├── data.mdb
82
+
| ├── lock.mdb
83
+
└── evaluation
84
+
├── IC03
85
+
│ ├── data.mdb
86
+
│ ├── lock.mdb
87
+
├── IC13
88
+
│ ├── data.mdb
89
+
│ ├── lock.mdb
90
+
└── ...
91
+
```
92
+
93
+
#### Check YAML Config Files
94
+
Please check the following important args: `system.distribute`, `system.val_while_train`, `common.batch_size`, `train.dataset.dataset_root`, `train.dataset.data_dir`, `train.dataset.label_file`,
95
+
`eval.dataset.dataset_root`, `eval.dataset.data_dir`, `eval.dataset.label_file`, `eval.loader.batch_size`. Explanations of these important args:
96
+
97
+
```yaml
98
+
system:
99
+
distribute: True # `True` for distributed training, `False` for standalone training
100
+
amp_level: 'O3'
101
+
seed: 42
102
+
val_while_train: True # Validate while training
103
+
drop_overflow_update: False
104
+
common:
105
+
...
106
+
batch_size: &batch_size 64 # Batch size for training
107
+
...
108
+
train:
109
+
ckpt_save_dir: './tmp_det'
110
+
dataset_sink_mode: True
111
+
dataset:
112
+
type: DetDataset
113
+
dataset_root: /data/ocr_datasets # Root dir of training dataset
114
+
data_dir: ic15/text_localization/train # Dir of training dataset, concatenated with `dataset_root` to be the complete dir of training dataset
115
+
label_file: ic15/text_localization/train/train_icdar15_label.txt # Path of training label file, concatenated with `dataset_root` to be the complete path of training label file
116
+
...
117
+
eval:
118
+
dataset_sink_mode: False
119
+
dataset:
120
+
type: DetDataset
121
+
dataset_root: /data/ocr_datasets # Root dir of validation/evaluation dataset
122
+
data_dir: ic15/text_localization/test # Dir of validation/evaluation dataset, concatenated with `dataset_root` to be the complete dir of validation/evaluation dataset
123
+
label_file: ic15/text_localization/test/test_icdar2015_label.txt # Path of validation/evaluation label file, concatenated with `dataset_root` to be the complete path of validation/evaluation label file
124
+
...
125
+
loader:
126
+
shuffle: False
127
+
batch_size: 64# Batch size for validation/evaluation
128
+
...
129
+
```
130
+
131
+
**Notes:**
132
+
- 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.
133
+
- When performing **Model Training**, if `system.val_while_train` is `True`, validation is performed while training. In this case, you should set `eval.dataset.dataset_root` as root dir of **validation** dataset, and set `eval.dataset.data_dir` as dir of **validation** dataset (e.g., `validation/`).
134
+
- When performing **Model Evaluation**, you should set `eval.dataset.dataset_root` as root dir of **evaluation** dataset, and set `eval.dataset.data_dir` as dir of **evaluation** dataset (e.g., `evaluation/DATASET_NAME/`).
135
+
136
+
137
+
### Model Training
70
138
<!--- Guideline: Avoid using shell script in the command line. Python script preferred. -->
71
139
72
140
* Distributed Training
@@ -90,9 +158,8 @@ If you want to train or finetune the model on a smaller dataset without distribu
**Note:** 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.
94
161
95
-
### Evaluation
162
+
### Model Evaluation
96
163
97
164
To evaluate the accuracy of the trained model, you can use `eval.py`. Please set the checkpoint path to the arg `ckpt_load_path` in the `eval` section of yaml config file and then run:
0 commit comments