Mountchicken commited on
Commit
174ad5e
1 Parent(s): 26febaf

[Update] Inital Update

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. app.py +139 -0
  2. mmocr-dev-1.x/.circleci/config.yml +34 -0
  3. mmocr-dev-1.x/.circleci/docker/Dockerfile +11 -0
  4. mmocr-dev-1.x/.circleci/test.yml +196 -0
  5. mmocr-dev-1.x/.codespellrc +5 -0
  6. mmocr-dev-1.x/.coveragerc +3 -0
  7. mmocr-dev-1.x/.dev_scripts/benchmark_full_models.txt +18 -0
  8. mmocr-dev-1.x/.dev_scripts/benchmark_options.py +7 -0
  9. mmocr-dev-1.x/.dev_scripts/benchmark_train_models.txt +9 -0
  10. mmocr-dev-1.x/.dev_scripts/covignore.cfg +18 -0
  11. mmocr-dev-1.x/.dev_scripts/diff_coverage_test.sh +43 -0
  12. mmocr-dev-1.x/.github/CODE_OF_CONDUCT.md +76 -0
  13. mmocr-dev-1.x/.github/CONTRIBUTING.md +1 -0
  14. mmocr-dev-1.x/.github/ISSUE_TEMPLATE/1-bug-report.yml +121 -0
  15. mmocr-dev-1.x/.github/ISSUE_TEMPLATE/2-feature_request.yml +39 -0
  16. mmocr-dev-1.x/.github/ISSUE_TEMPLATE/3-new-model.yml +51 -0
  17. mmocr-dev-1.x/.github/ISSUE_TEMPLATE/4-documentation.yml +48 -0
  18. mmocr-dev-1.x/.github/ISSUE_TEMPLATE/config.yml +12 -0
  19. mmocr-dev-1.x/.github/pull_request_template.md +33 -0
  20. mmocr-dev-1.x/.github/workflows/lint.yml +27 -0
  21. mmocr-dev-1.x/.github/workflows/merge_stage_test.yml +160 -0
  22. mmocr-dev-1.x/.github/workflows/pr_stage_test.yml +102 -0
  23. mmocr-dev-1.x/.github/workflows/publish-to-pypi.yml +26 -0
  24. mmocr-dev-1.x/.github/workflows/test_mim.yml +44 -0
  25. mmocr-dev-1.x/.gitignore +146 -0
  26. mmocr-dev-1.x/.owners.yml +9 -0
  27. mmocr-dev-1.x/.pre-commit-config.yaml +63 -0
  28. mmocr-dev-1.x/.pylintrc +621 -0
  29. mmocr-dev-1.x/.readthedocs.yml +9 -0
  30. mmocr-dev-1.x/CITATION.cff +9 -0
  31. mmocr-dev-1.x/LICENSE +203 -0
  32. mmocr-dev-1.x/MANIFEST.in +5 -0
  33. mmocr-dev-1.x/README.md +251 -0
  34. mmocr-dev-1.x/README_zh-CN.md +250 -0
  35. mmocr-dev-1.x/configs/backbone/oclip/README.md +41 -0
  36. mmocr-dev-1.x/configs/backbone/oclip/metafile.yml +13 -0
  37. mmocr-dev-1.x/configs/kie/_base_/datasets/wildreceipt-openset.py +26 -0
  38. mmocr-dev-1.x/configs/kie/_base_/datasets/wildreceipt.py +16 -0
  39. mmocr-dev-1.x/configs/kie/_base_/default_runtime.py +33 -0
  40. mmocr-dev-1.x/configs/kie/_base_/schedules/schedule_adam_60e.py +10 -0
  41. mmocr-dev-1.x/configs/kie/sdmgr/README.md +41 -0
  42. mmocr-dev-1.x/configs/kie/sdmgr/_base_sdmgr_novisual.py +35 -0
  43. mmocr-dev-1.x/configs/kie/sdmgr/_base_sdmgr_unet16.py +28 -0
  44. mmocr-dev-1.x/configs/kie/sdmgr/metafile.yml +52 -0
  45. mmocr-dev-1.x/configs/kie/sdmgr/sdmgr_novisual_60e_wildreceipt-openset.py +71 -0
  46. mmocr-dev-1.x/configs/kie/sdmgr/sdmgr_novisual_60e_wildreceipt.py +28 -0
  47. mmocr-dev-1.x/configs/kie/sdmgr/sdmgr_unet16_60e_wildreceipt.py +29 -0
  48. mmocr-dev-1.x/configs/textdet/_base_/datasets/ctw1500.py +15 -0
  49. mmocr-dev-1.x/configs/textdet/_base_/datasets/icdar2015.py +15 -0
  50. mmocr-dev-1.x/configs/textdet/_base_/datasets/icdar2017.py +17 -0
app.py ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import argparse
3
+ import gradio as gr
4
+ import numpy as np
5
+
6
+ # MMOCR
7
+ from mmocr.apis.inferencers import MMOCRInferencer
8
+
9
+ # BUILD MMOCR
10
+
11
+
12
+ def arg_parse():
13
+ parser = argparse.ArgumentParser(description='MMOCR demo for gradio app')
14
+ parser.add_argument(
15
+ '--rec_config',
16
+ type=str,
17
+ default='mmocr-dev-1.x/configs/textrecog/maerec/maerec_b_union14m.py',
18
+ help='The recognition config file.')
19
+ parser.add_argument(
20
+ '--rec_weight',
21
+ type=str,
22
+ default=
23
+ 'mmocr-dev-1.x/work_dirs/maerec_b_union14m/maerec_b_union14m.pth',
24
+ help='The recognition weight file.')
25
+ parser.add_argument(
26
+ '--det_config',
27
+ type=str,
28
+ default=
29
+ 'mmocr-dev-1.x/configs/textdet/dbnetpp/dbnetpp_resnet50-oclip_fpnc_1200e_icdar2015.py', # noqa,
30
+ help='The detection config file.')
31
+ parser.add_argument(
32
+ '--det_weight',
33
+ type=str,
34
+ default='mmocr-dev-1.x/dbnetpp.pth',
35
+ help='The detection weight file.')
36
+ parser.add_argument(
37
+ '--device',
38
+ type=str,
39
+ default='cuda:0',
40
+ help='The device used for inference.')
41
+ args = parser.parse_args()
42
+ return args
43
+
44
+
45
+ def run_mmocr(img: np.ndarray, use_detector: bool = True):
46
+ """Run MMOCR and SAM
47
+
48
+ Args:
49
+ img (np.ndarray): Input image
50
+ use_detector (bool, optional): Whether to use detector. Defaults to
51
+ True.
52
+ """
53
+ if use_detector:
54
+ mode = 'det_rec'
55
+ else:
56
+ mode = 'rec'
57
+ # Build MMOCR
58
+ mmocr_inferencer.mode = mode
59
+ result = mmocr_inferencer(img, return_vis=True)
60
+ visualization = result['visualization'][0]
61
+ result = result['predictions'][0]
62
+
63
+ if mode == 'det_rec':
64
+ rec_texts = result['rec_texts']
65
+ det_polygons = result['det_polygons']
66
+ det_results = []
67
+ for rec_text, det_polygon in zip(rec_texts, det_polygons):
68
+ det_polygon = np.array(det_polygon).astype(np.int32).tolist()
69
+ det_results.append(f'{rec_text}: {det_polygon}')
70
+ out_results = '\n'.join(det_results)
71
+ visualization = cv2.cvtColor(
72
+ np.array(visualization), cv2.COLOR_RGB2BGR)
73
+ else:
74
+ rec_text = result['rec_texts'][0]
75
+ rec_score = result['rec_scores'][0]
76
+ out_results = f'pred: {rec_text} \n score: {rec_score:.2f}'
77
+ visualization = None
78
+ return visualization, out_results
79
+
80
+
81
+ if __name__ == '__main__':
82
+ args = arg_parse()
83
+ mmocr_inferencer = MMOCRInferencer(
84
+ args.det_config,
85
+ args.det_weight,
86
+ args.rec_config,
87
+ args.rec_weight,
88
+ device=args.device)
89
+
90
+ with gr.Blocks() as demo:
91
+ with gr.Row():
92
+ with gr.Column(scale=1):
93
+ gr.HTML("""
94
+ <div style="text-align: center; max-width: 1200px; margin: 20px auto;">
95
+ <h1 style="font-weight: 900; font-size: 3rem; margin: 0rem">
96
+ MAERec: A MAE-pretrained Scene Text Recognizer
97
+ </h1>
98
+ <h3 style="font-weight: 450; font-size: 1rem; margin: 0rem">
99
+ [<a href="https://arxiv.org/abs/2305.10855" style="color:blue;">arXiv</a>]
100
+ [<a href="https://github.com/Mountchicken/Union14M" style="color:green;">Code</a>]
101
+ </h3>
102
+ <h2 style="text-align: left; font-weight: 600; font-size: 1rem; margin-top: 0.5rem; margin-bottom: 0.5rem">
103
+ MAERec is a scene text recognition model composed of a ViT backbone and a Transformer decoder in auto-regressive
104
+ style. It shows an outstanding performance in scene text recognition, especially when pre-trained on the
105
+ Union14M-U through MAE.
106
+ </h2>
107
+ <h2 style="text-align: left; font-weight: 600; font-size: 1rem; margin-top: 0.5rem; margin-bottom: 0.5rem">
108
+ In this demo, we combine MAERec with DBNet++ to build an
109
+ end-to-end scene text recognition model.
110
+ </h2>
111
+ </div>
112
+ """)
113
+ gr.Image('github/maerec.png')
114
+ with gr.Column(scale=1):
115
+ input_image = gr.Image(label='Input Image')
116
+ output_image = gr.Image(label='Output Image')
117
+ use_detector = gr.Checkbox(
118
+ label=
119
+ 'Use Scene Text Detector or Not (Disabled for Recognition Only)',
120
+ default=True)
121
+ det_results = gr.Textbox(label='Detection Results')
122
+ mmocr = gr.Button('Run MMOCR')
123
+ gr.Markdown("## Image Examples")
124
+ with gr.Row():
125
+ gr.Examples(
126
+ examples=[
127
+ 'github/author.jpg', 'github/gradio1.jpeg',
128
+ 'github/Art_Curve_178.jpg', 'github/cute_3.jpg',
129
+ 'github/cute_168.jpg', 'github/hiercurve_2229.jpg',
130
+ 'github/ic15_52.jpg', 'github/ic15_698.jpg',
131
+ 'github/Art_Curve_352.jpg'
132
+ ],
133
+ inputs=input_image,
134
+ )
135
+ mmocr.click(
136
+ fn=run_mmocr,
137
+ inputs=[input_image, use_detector],
138
+ outputs=[output_image, det_results])
139
+ demo.launch(debug=True)
mmocr-dev-1.x/.circleci/config.yml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: 2.1
2
+
3
+ # this allows you to use CircleCI's dynamic configuration feature
4
+ setup: true
5
+
6
+ # the path-filtering orb is required to continue a pipeline based on
7
+ # the path of an updated fileset
8
+ orbs:
9
+ path-filtering: circleci/[email protected]
10
+
11
+ workflows:
12
+ # the always-run workflow is always triggered, regardless of the pipeline parameters.
13
+ always-run:
14
+ jobs:
15
+ # the path-filtering/filter job determines which pipeline
16
+ # parameters to update.
17
+ - path-filtering/filter:
18
+ name: check-updated-files
19
+ # 3-column, whitespace-delimited mapping. One mapping per
20
+ # line:
21
+ # <regex path-to-test> <parameter-to-set> <value-of-pipeline-parameter>
22
+ mapping: |
23
+ mmocr/.* lint_only false
24
+ requirements/.* lint_only false
25
+ tests/.* lint_only false
26
+ tools/.* lint_only false
27
+ configs/.* lint_only false
28
+ .circleci/.* lint_only false
29
+ base-revision: dev-1.x
30
+ # this is the path of the configuration we should trigger once
31
+ # path filtering and pipeline parameter value updates are
32
+ # complete. In this case, we are using the parent dynamic
33
+ # configuration itself.
34
+ config-path: .circleci/test.yml
mmocr-dev-1.x/.circleci/docker/Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ARG PYTORCH="1.8.1"
2
+ ARG CUDA="10.2"
3
+ ARG CUDNN="7"
4
+
5
+ FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
6
+
7
+ # To fix GPG key error when running apt-get update
8
+ RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
9
+ RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
10
+
11
+ RUN apt-get update && apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx
mmocr-dev-1.x/.circleci/test.yml ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: 2.1
2
+
3
+ # the default pipeline parameters, which will be updated according to
4
+ # the results of the path-filtering orb
5
+ parameters:
6
+ lint_only:
7
+ type: boolean
8
+ default: true
9
+
10
+ jobs:
11
+ lint:
12
+ docker:
13
+ - image: cimg/python:3.7.4
14
+ steps:
15
+ - checkout
16
+ - run:
17
+ name: Install pre-commit hook
18
+ command: |
19
+ pip install pre-commit
20
+ pre-commit install
21
+ - run:
22
+ name: Linting
23
+ command: pre-commit run --all-files
24
+ - run:
25
+ name: Check docstring coverage
26
+ command: |
27
+ pip install interrogate
28
+ interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-magic --ignore-regex "__repr__" --fail-under 90 mmocr
29
+ build_cpu:
30
+ parameters:
31
+ # The python version must match available image tags in
32
+ # https://circleci.com/developer/images/image/cimg/python
33
+ python:
34
+ type: string
35
+ torch:
36
+ type: string
37
+ torchvision:
38
+ type: string
39
+ docker:
40
+ - image: cimg/python:<< parameters.python >>
41
+ resource_class: large
42
+ steps:
43
+ - checkout
44
+ - run:
45
+ name: Install Libraries
46
+ command: |
47
+ sudo apt-get update
48
+ sudo apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx libjpeg-dev zlib1g-dev libtinfo-dev libncurses5 libgeos-dev
49
+ - run:
50
+ name: Configure Python & pip
51
+ command: |
52
+ pip install --upgrade pip
53
+ pip install wheel
54
+ - run:
55
+ name: Install PyTorch
56
+ command: |
57
+ python -V
58
+ pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
59
+ - run:
60
+ name: Install mmocr dependencies
61
+ command: |
62
+ pip install git+https://github.com/open-mmlab/mmengine.git@main
63
+ pip install -U openmim
64
+ mim install 'mmcv >= 2.0.0rc1'
65
+ pip install git+https://github.com/open-mmlab/[email protected]
66
+ pip install -r requirements/tests.txt
67
+ - run:
68
+ name: Build and install
69
+ command: |
70
+ pip install -e .
71
+ - run:
72
+ name: Run unittests
73
+ command: |
74
+ coverage run --branch --source mmocr -m pytest tests/
75
+ coverage xml
76
+ coverage report -m
77
+ build_cuda:
78
+ parameters:
79
+ torch:
80
+ type: string
81
+ cuda:
82
+ type: enum
83
+ enum: ["10.1", "10.2", "11.1", "11.7"]
84
+ cudnn:
85
+ type: integer
86
+ default: 7
87
+ machine:
88
+ image: ubuntu-2004-cuda-11.4:202110-01
89
+ # docker_layer_caching: true
90
+ resource_class: gpu.nvidia.small
91
+ steps:
92
+ - checkout
93
+ - run:
94
+ # Cloning repos in VM since Docker doesn't have access to the private key
95
+ name: Clone Repos
96
+ command: |
97
+ git clone -b main --depth 1 https://github.com/open-mmlab/mmengine.git /home/circleci/mmengine
98
+ git clone -b dev-3.x --depth 1 https://github.com/open-mmlab/mmdetection.git /home/circleci/mmdetection
99
+ - run:
100
+ name: Build Docker image
101
+ command: |
102
+ docker build .circleci/docker -t mmocr:gpu --build-arg PYTORCH=<< parameters.torch >> --build-arg CUDA=<< parameters.cuda >> --build-arg CUDNN=<< parameters.cudnn >>
103
+ docker run --gpus all -t -d -v /home/circleci/project:/mmocr -v /home/circleci/mmengine:/mmengine -v /home/circleci/mmdetection:/mmdetection -w /mmocr --name mmocr mmocr:gpu
104
+ - run:
105
+ name: Install mmocr dependencies
106
+ command: |
107
+ docker exec mmocr pip install -e /mmengine
108
+ docker exec mmocr pip install -U openmim
109
+ docker exec mmocr mim install 'mmcv >= 2.0.0rc1'
110
+ docker exec mmocr pip install -e /mmdetection
111
+ docker exec mmocr pip install -r requirements/tests.txt
112
+ - run:
113
+ name: Build and install
114
+ command: |
115
+ docker exec mmocr pip install -e .
116
+ - run:
117
+ name: Run unittests
118
+ command: |
119
+ docker exec mmocr pytest tests/
120
+
121
+ workflows:
122
+ pr_stage_lint:
123
+ when: << pipeline.parameters.lint_only >>
124
+ jobs:
125
+ - lint:
126
+ name: lint
127
+ filters:
128
+ branches:
129
+ ignore:
130
+ - dev-1.x
131
+ - 1.x
132
+ - main
133
+ pr_stage_test:
134
+ when:
135
+ not:
136
+ << pipeline.parameters.lint_only >>
137
+ jobs:
138
+ - lint:
139
+ name: lint
140
+ filters:
141
+ branches:
142
+ ignore:
143
+ - dev-1.x
144
+ - test-1.x
145
+ - main
146
+ - build_cpu:
147
+ name: minimum_version_cpu
148
+ torch: 1.6.0
149
+ torchvision: 0.7.0
150
+ python: "3.7"
151
+ requires:
152
+ - lint
153
+ - build_cpu:
154
+ name: maximum_version_cpu
155
+ torch: 2.0.0
156
+ torchvision: 0.15.1
157
+ python: 3.9.0
158
+ requires:
159
+ - minimum_version_cpu
160
+ - hold:
161
+ type: approval
162
+ requires:
163
+ - maximum_version_cpu
164
+ - build_cuda:
165
+ name: mainstream_version_gpu
166
+ torch: 1.8.1
167
+ # Use double quotation mark to explicitly specify its type
168
+ # as string instead of number
169
+ cuda: "10.2"
170
+ requires:
171
+ - hold
172
+ - build_cuda:
173
+ name: mainstream_version_gpu
174
+ torch: 2.0.0
175
+ # Use double quotation mark to explicitly specify its type
176
+ # as string instead of number
177
+ cuda: "11.7"
178
+ cudnn: 8
179
+ requires:
180
+ - hold
181
+ merge_stage_test:
182
+ when:
183
+ not:
184
+ << pipeline.parameters.lint_only >>
185
+ jobs:
186
+ - build_cuda:
187
+ name: minimum_version_gpu
188
+ torch: 1.6.0
189
+ # Use double quotation mark to explicitly specify its type
190
+ # as string instead of number
191
+ cuda: "10.1"
192
+ filters:
193
+ branches:
194
+ only:
195
+ - dev-1.x
196
+ - main
mmocr-dev-1.x/.codespellrc ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ [codespell]
2
+ skip = *.ipynb
3
+ count =
4
+ quiet-level = 3
5
+ ignore-words-list = convertor,convertors,formating,nin,wan,datas,hist,ned
mmocr-dev-1.x/.coveragerc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [run]
2
+ omit =
3
+ */__init__.py
mmocr-dev-1.x/.dev_scripts/benchmark_full_models.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ textdet/dbnet/dbnet_resnet18_fpnc_1200e_icdar2015.py
2
+ textdet/dbnetpp/dbnetpp_resnet50-dcnv2_fpnc_1200e_icdar2015.py
3
+ textdet/drrg/drrg_resnet50_fpn-unet_1200e_ctw1500.py
4
+ textdet/fcenet/fcenet_resnet50_fpn_1500e_icdar2015.py
5
+ textdet/maskrcnn/mask-rcnn_resnet50_fpn_160e_icdar2015.py
6
+ textdet/panet/panet_resnet18_fpem-ffm_600e_icdar2015.py
7
+ textdet/psenet/psenet_resnet50_fpnf_600e_icdar2015.py
8
+ textdet/textsnake/textsnake_resnet50_fpn-unet_1200e_ctw1500.py
9
+ textrecog/abinet/abinet-vision_20e_st-an_mj.py
10
+ textrecog/crnn/crnn_mini-vgg_5e_mj.py
11
+ textrecog/master/master_resnet31_12e_st_mj_sa.py
12
+ textrecog/nrtr/nrtr_resnet31-1by16-1by8_6e_st_mj.py
13
+ textrecog/robust_scanner/robustscanner_resnet31_5e_st-sub_mj-sub_sa_real.py
14
+ textrecog/sar/sar_resnet31_parallel-decoder_5e_st-sub_mj-sub_sa_real.py
15
+ textrecog/satrn/satrn_shallow-small_5e_st_mj.py
16
+ textrecog/satrn/satrn_shallow-small_5e_st_mj.py
17
+ textrecog/aster/aster_resnet45_6e_st_mj.py
18
+ textrecog/svtr/svtr-small_20e_st_mj.py
mmocr-dev-1.x/.dev_scripts/benchmark_options.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Copyright (c) OpenMMLab. All rights reserved.
2
+
3
+ third_part_libs = [
4
+ 'pip install -r ../requirements/albu.txt',
5
+ ]
6
+
7
+ default_floating_range = 0.5
mmocr-dev-1.x/.dev_scripts/benchmark_train_models.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ textdet/dbnetpp/dbnetpp_resnet50-dcnv2_fpnc_1200e_icdar2015.py
2
+ textdet/fcenet/fcenet_resnet50_fpn_1500e_icdar2015.py
3
+ textdet/maskrcnn/mask-rcnn_resnet50_fpn_160e_icdar2015.py
4
+ textrecog/abinet/abinet-vision_20e_st-an_mj.py
5
+ textrecog/crnn/crnn_mini-vgg_5e_mj.py
6
+ textrecog/aster/aster_resnet45_6e_st_mj.py
7
+ textrecog/nrtr/nrtr_resnet31-1by16-1by8_6e_st_mj.py
8
+ textrecog/sar/sar_resnet31_parallel-decoder_5e_st-sub_mj-sub_sa_real.py
9
+ textrecog/svtr/svtr-small_20e_st_mj.py
mmocr-dev-1.x/.dev_scripts/covignore.cfg ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Each line should be the relative path to the root directory
2
+ # of this repo. Support regular expression as well.
3
+ # For example:
4
+ # mmocr/models/textdet/postprocess/utils.py
5
+ # .*/utils.py
6
+ .*/__init__.py
7
+
8
+ # It will be removed after all models have been refactored
9
+ mmocr/utils/bbox_utils.py
10
+
11
+ # Major part is covered, however, it's hard to cover model's output.
12
+ mmocr/models/textdet/detectors/mmdet_wrapper.py
13
+
14
+ # It will be removed after KieVisualizer and TextSpotterVisualizer
15
+ mmocr/visualization/visualize.py
16
+
17
+ # Add tests for data preparers later
18
+ mmocr/datasets/preparers
mmocr-dev-1.x/.dev_scripts/diff_coverage_test.sh ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ readarray -t IGNORED_FILES < $( dirname "$0" )/covignore.cfg
6
+
7
+ REUSE_COVERAGE_REPORT=${REUSE_COVERAGE_REPORT:-0}
8
+ REPO=${1:-"origin"}
9
+ BRANCH=${2:-"refactor_dev"}
10
+
11
+ git fetch $REPO $BRANCH
12
+
13
+ PY_FILES=""
14
+ for FILE_NAME in $(git diff --name-only ${REPO}/${BRANCH}); do
15
+ # Only test python files in mmocr/ existing in current branch, and not ignored in covignore.cfg
16
+ if [ ${FILE_NAME: -3} == ".py" ] && [ ${FILE_NAME:0:6} == "mmocr/" ] && [ -f "$FILE_NAME" ]; then
17
+ IGNORED=false
18
+ for IGNORED_FILE_NAME in "${IGNORED_FILES[@]}"; do
19
+ # Skip blank lines
20
+ if [ -z "$IGNORED_FILE_NAME" ]; then
21
+ continue
22
+ fi
23
+ if [ "${IGNORED_FILE_NAME::1}" != "#" ] && [[ "$FILE_NAME" =~ $IGNORED_FILE_NAME ]]; then
24
+ echo "Ignoring $FILE_NAME"
25
+ IGNORED=true
26
+ break
27
+ fi
28
+ done
29
+ if [ "$IGNORED" = false ]; then
30
+ PY_FILES="$PY_FILES $FILE_NAME"
31
+ fi
32
+ fi
33
+ done
34
+
35
+ # Only test the coverage when PY_FILES are not empty, otherwise they will test the entire project
36
+ if [ ! -z "${PY_FILES}" ]
37
+ then
38
+ if [ "$REUSE_COVERAGE_REPORT" == "0" ]; then
39
+ coverage run --branch --source mmocr -m pytest tests/
40
+ fi
41
+ coverage report --fail-under 90 -m $PY_FILES
42
+ interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-magic --ignore-regex "__repr__" --fail-under 95 $PY_FILES
43
+ fi
mmocr-dev-1.x/.github/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at [email protected]. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ For answers to common questions about this code of conduct, see
74
+ https://www.contributor-covenant.org/faq
75
+
76
+ [homepage]: https://www.contributor-covenant.org
mmocr-dev-1.x/.github/CONTRIBUTING.md ADDED
@@ -0,0 +1 @@
 
 
1
+ We appreciate all contributions to improve MMOCR. Please read [Contribution Guide](/docs/en/notes/contribution_guide.md) for step-by-step instructions to make a contribution to MMOCR, and [CONTRIBUTING.md](https://github.com/open-mmlab/mmcv/blob/master/CONTRIBUTING.md) in MMCV for more details about the contributing guideline.
mmocr-dev-1.x/.github/ISSUE_TEMPLATE/1-bug-report.yml ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "🐞 Bug report"
2
+ description: "Create a report to help us reproduce and fix the bug"
3
+ labels: kind/bug
4
+ title: "[Bug] "
5
+
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ ## Note
11
+ For general usage questions or idea discussions, please post it to our [**Forum**](https://github.com/open-mmlab/mmocr/discussions)
12
+ If this issue is about installing MMCV, please file an issue at [MMCV](https://github.com/open-mmlab/mmcv/issues/new/choose).
13
+ If it's anything about model deployment, please raise it to [MMDeploy](https://github.com/open-mmlab/mmdeploy)
14
+
15
+ Please fill in as **much** of the following form as you're able to. **The clearer the description, the shorter it will take to solve it.**
16
+
17
+ - type: checkboxes
18
+ attributes:
19
+ label: Prerequisite
20
+ description: Please check the following items before creating a new issue.
21
+ options:
22
+ - label: I have searched [Issues](https://github.com/open-mmlab/mmocr/issues) and [Discussions](https://github.com/open-mmlab/mmocr/discussions) but cannot get the expected help.
23
+ required: true
24
+ # - label: I have read the [FAQ documentation](https://mmocr.readthedocs.io/en/1.x/notes/4_faq.html) but cannot get the expected help.
25
+ # required: true
26
+ - label: The bug has not been fixed in the [latest version (0.x)](https://github.com/open-mmlab/mmocr) or [latest version (1.x)](https://github.com/open-mmlab/mmocr/tree/dev-1.x).
27
+ required: true
28
+
29
+ - type: dropdown
30
+ id: task
31
+ attributes:
32
+ label: Task
33
+ description: The problem arises when
34
+ options:
35
+ - I'm using the official example scripts/configs for the officially supported tasks/models/datasets.
36
+ - I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.
37
+ validations:
38
+ required: true
39
+
40
+ - type: dropdown
41
+ id: branch
42
+ attributes:
43
+ label: Branch
44
+ description: The problem arises when I'm working on
45
+ options:
46
+ - main branch https://github.com/open-mmlab/mmocr
47
+ - 1.x branch https://github.com/open-mmlab/mmocr/tree/dev-1.x
48
+ validations:
49
+ required: true
50
+
51
+ - type: textarea
52
+ attributes:
53
+ label: Environment
54
+ description: |
55
+ Please run `python mmocr/utils/collect_env.py` to collect necessary environment information and copy-paste it here.
56
+ You may add additional information that may be helpful for locating the problem, such as
57
+ - How you installed PyTorch \[e.g., pip, conda, source\]
58
+ - Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.)
59
+ validations:
60
+ required: true
61
+
62
+ - type: textarea
63
+ attributes:
64
+ label: Reproduces the problem - code sample
65
+ description: |
66
+ Please provide a code sample that reproduces the problem you ran into. It can be a Colab link or just a code snippet.
67
+ placeholder: |
68
+ ```python
69
+ # Sample code to reproduce the problem
70
+ ```
71
+ validations:
72
+ required: true
73
+
74
+ - type: textarea
75
+ attributes:
76
+ label: Reproduces the problem - command or script
77
+ description: |
78
+ What command or script did you run?
79
+ placeholder: |
80
+ ```shell
81
+ The command or script you run.
82
+ ```
83
+ validations:
84
+ required: true
85
+
86
+ - type: textarea
87
+ attributes:
88
+ label: Reproduces the problem - error message
89
+ description: |
90
+ Please provide the error message or logs you got, with the full traceback.
91
+
92
+ Tip: You can attach images or log files by dragging them into the text area..
93
+ placeholder: |
94
+ ```
95
+ The error message or logs you got, with the full traceback.
96
+ ```
97
+ validations:
98
+ required: true
99
+
100
+ - type: textarea
101
+ attributes:
102
+ label: Additional information
103
+ description: |
104
+ Tell us anything else you think we should know.
105
+
106
+ Tip: You can attach images or log files by dragging them into the text area.
107
+ placeholder: |
108
+ 1. What's your expected result?
109
+ 2. What dataset did you use?
110
+ 3. What do you think might be the reason?
111
+
112
+ - type: markdown
113
+ attributes:
114
+ value: |
115
+ ## Acknowledgement
116
+ Thanks for taking the time to fill out this report.
117
+
118
+ If you have already identified the reason, we strongly appreciate you creating a new PR to fix it [**Here**](https://github.com/open-mmlab/mmocr/pulls)!
119
+ Please refer to [**Contribution Guide**](https://mmocr.readthedocs.io/en/dev-1.x/notes/contribution_guide.html) for contributing.
120
+
121
+ Welcome to join our [**Community**](https://mmocr.readthedocs.io/en/latest/contact.html) to discuss together. 👬
mmocr-dev-1.x/.github/ISSUE_TEMPLATE/2-feature_request.yml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 🚀 Feature request
2
+ description: Suggest an idea for this project
3
+ labels: [feature-request]
4
+ title: "[Feature] "
5
+
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ ## Note
11
+ For general usage questions or idea discussions, please post it to our [**Forum**](https://github.com/open-mmlab/mmocr/discussions)
12
+
13
+ Please fill in as **much** of the following form as you're able to. **The clearer the description, the shorter it will take to solve it.**
14
+
15
+ - type: textarea
16
+ attributes:
17
+ label: What is the feature?
18
+ description: Tell us more about the feature and how this feature can help.
19
+ placeholder: |
20
+ E.g., It is inconvenient when \[....\].
21
+ validations:
22
+ required: true
23
+
24
+ - type: textarea
25
+ attributes:
26
+ label: Any other context?
27
+ description: |
28
+ Have you considered any alternative solutions or features? If so, what are they? Also, feel free to add any other context or screenshots about the feature request here.
29
+
30
+ - type: markdown
31
+ attributes:
32
+ value: |
33
+ ## Acknowledgement
34
+ Thanks for taking the time to fill out this report.
35
+
36
+ We strongly appreciate you creating a new PR to implement it [**Here**](https://github.com/open-mmlab/mmocr/pulls)!
37
+ Please refer to [**Contribution Guide**](https://mmocr.readthedocs.io/en/dev-1.x/notes/contribution_guide.html) for contributing.
38
+
39
+ Welcome to join our [**Community**](https://mmocr.readthedocs.io/en/latest/contact.html) to discuss together. 👬
mmocr-dev-1.x/.github/ISSUE_TEMPLATE/3-new-model.yml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "\U0001F31F New model/dataset/scheduler addition"
2
+ description: Submit a proposal/request to implement a new model / dataset / scheduler
3
+ labels: [ "feature-request" ]
4
+ title: "[New Models] "
5
+
6
+
7
+ body:
8
+ - type: markdown
9
+ attributes:
10
+ value: |
11
+ ## Note
12
+ For general usage questions or idea discussions, please post it to our [**Forum**](https://github.com/open-mmlab/mmocr/discussions)
13
+
14
+ Please fill in as **much** of the following form as you're able to. **The clearer the description, the shorter it will take to solve it.**
15
+
16
+ - type: textarea
17
+ id: description-request
18
+ validations:
19
+ required: true
20
+ attributes:
21
+ label: Model/Dataset/Scheduler description
22
+ description: |
23
+ Put any and all important information relative to the model/dataset/scheduler
24
+
25
+ - type: checkboxes
26
+ attributes:
27
+ label: Open source status
28
+ description: |
29
+ Please provide the open-source status, which would be very helpful
30
+ options:
31
+ - label: "The model implementation is available"
32
+ - label: "The model weights are available."
33
+
34
+ - type: textarea
35
+ id: additional-info
36
+ attributes:
37
+ label: Provide useful links for the implementation
38
+ description: |
39
+ Please provide information regarding the implementation, the weights, and the authors.
40
+ Please mention the authors by @gh-username if you're aware of their usernames.
41
+
42
+ - type: markdown
43
+ attributes:
44
+ value: |
45
+ ## Acknowledgement
46
+ Thanks for taking the time to fill out this report.
47
+
48
+ We strongly appreciate you creating a new PR to implement it [**Here**](https://github.com/open-mmlab/mmocr/pulls)!
49
+ Please refer to [**Contribution Guide**](https://mmocr.readthedocs.io/en/dev-1.x/notes/contribution_guide.html) for contributing.
50
+
51
+ Welcome to join our [**Community**](https://mmocr.readthedocs.io/en/latest/contact.html) to discuss together. 👬
mmocr-dev-1.x/.github/ISSUE_TEMPLATE/4-documentation.yml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 📚 Documentation
2
+ description: Report an issue related to the documentation.
3
+ labels: "docs"
4
+ title: "[Docs] "
5
+
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ ## Note
11
+ For general usage questions or idea discussions, please post it to our [**Forum**](https://github.com/open-mmlab/mmocr/discussions)
12
+ Please fill in as **much** of the following form as you're able to. **The clearer the description, the shorter it will take to solve it.**
13
+
14
+ - type: dropdown
15
+ id: branch
16
+ attributes:
17
+ label: Branch
18
+ description: This issue is related to the
19
+ options:
20
+ - master branch https://mmocr.readthedocs.io/en/latest/
21
+ - 1.x branch https://mmocr.readthedocs.io/en/dev-1.x/
22
+ validations:
23
+ required: true
24
+
25
+ - type: textarea
26
+ attributes:
27
+ label: 📚 The doc issue
28
+ description: >
29
+ A clear and concise description the issue.
30
+ validations:
31
+ required: true
32
+
33
+ - type: textarea
34
+ attributes:
35
+ label: Suggest a potential alternative/fix
36
+ description: >
37
+ Tell us how we could improve the documentation in this regard.
38
+
39
+ - type: markdown
40
+ attributes:
41
+ value: |
42
+ ## Acknowledgement
43
+ Thanks for taking the time to fill out this report.
44
+
45
+ If you have already identified the reason, we strongly appreciate you creating a new PR to fix it [**here**](https://github.com/open-mmlab/mmocr/pulls)!
46
+ Please refer to [**Contribution Guide**](https://mmocr.readthedocs.io/en/dev-1.x/notes/contribution_guide.html) for contributing.
47
+
48
+ Welcome to join our [**Community**](https://mmocr.readthedocs.io/en/latest/contact.html) to discuss together. 👬
mmocr-dev-1.x/.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ blank_issues_enabled: false
2
+
3
+ contact_links:
4
+ - name: ❔ FAQ
5
+ url: https://mmocr.readthedocs.io/en/dev-1.x/get_started/faq.html
6
+ about: Is your question frequently asked?
7
+ - name: 💬 Forum
8
+ url: https://github.com/open-mmlab/mmocr/discussions
9
+ about: Ask general usage questions and discuss with other MMOCR community members
10
+ - name: 🌐 Explore OpenMMLab
11
+ url: https://openmmlab.com/
12
+ about: Get know more about OpenMMLab
mmocr-dev-1.x/.github/pull_request_template.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
2
+
3
+ ## Motivation
4
+
5
+ Please describe the motivation of this PR and the goal you want to achieve through this PR.
6
+
7
+ ## Modification
8
+
9
+ Please briefly describe what modification is made in this PR.
10
+
11
+ ## BC-breaking (Optional)
12
+
13
+ Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
14
+ If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
15
+
16
+ ## Use cases (Optional)
17
+
18
+ If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
19
+
20
+ ## Checklist
21
+
22
+ **Before PR**:
23
+
24
+ - [ ] I have read and followed the workflow indicated in the [CONTRIBUTING.md](https://github.com/open-mmlab/mmocr/blob/main/.github/CONTRIBUTING.md) to create this PR.
25
+ - [ ] Pre-commit or linting tools indicated in [CONTRIBUTING.md](https://github.com/open-mmlab/mmocr/blob/main/.github/CONTRIBUTING.md) are used to fix the potential lint issues.
26
+ - [ ] Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
27
+ - [ ] New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
28
+ - [ ] The documentation has been modified accordingly, including docstring or example tutorials.
29
+
30
+ **After PR**:
31
+
32
+ - [ ] If the modification has potential influence on downstream or other related projects, this PR should be tested with some of those projects.
33
+ - [ ] CLA has been signed and all committers have signed the CLA in this PR.
mmocr-dev-1.x/.github/workflows/lint.yml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: lint
2
+
3
+ on: [push, pull_request]
4
+
5
+ concurrency:
6
+ group: ${{ github.workflow }}-${{ github.ref }}
7
+ cancel-in-progress: true
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Python 3.7
15
+ uses: actions/setup-python@v2
16
+ with:
17
+ python-version: 3.7
18
+ - name: Install pre-commit hook
19
+ run: |
20
+ pip install pre-commit
21
+ pre-commit install
22
+ - name: Linting
23
+ run: pre-commit run --all-files
24
+ - name: Check docstring coverage
25
+ run: |
26
+ pip install interrogate
27
+ interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 90 mmocr
mmocr-dev-1.x/.github/workflows/merge_stage_test.yml ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: merge_stage_test
2
+
3
+ on:
4
+ push:
5
+ paths-ignore:
6
+ - 'README.md'
7
+ - 'README_zh-CN.md'
8
+ - 'docs/**'
9
+ - 'demo/**'
10
+ - '.dev_scripts/**'
11
+ - '.circleci/**'
12
+ - 'projects/**'
13
+ branches:
14
+ - dev-1.x
15
+
16
+ concurrency:
17
+ group: ${{ github.workflow }}-${{ github.ref }}
18
+ cancel-in-progress: true
19
+
20
+ jobs:
21
+ build_cpu_py:
22
+ runs-on: ubuntu-22.04
23
+ strategy:
24
+ matrix:
25
+ python-version: [3.8, 3.9]
26
+ torch: [1.8.1]
27
+ include:
28
+ - torch: 1.8.1
29
+ torchvision: 0.9.1
30
+ steps:
31
+ - uses: actions/checkout@v3
32
+ - name: Set up Python ${{ matrix.python-version }}
33
+ uses: actions/setup-python@v4
34
+ with:
35
+ python-version: ${{ matrix.python-version }}
36
+ - name: Upgrade pip
37
+ run: pip install pip --upgrade
38
+ - name: Install PyTorch
39
+ run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
40
+ - name: Install MMEngine
41
+ run: pip install git+https://github.com/open-mmlab/mmengine.git@main
42
+ - name: Install MMCV
43
+ run: |
44
+ pip install -U openmim
45
+ mim install 'mmcv >= 2.0.0rc1'
46
+ - name: Install MMDet
47
+ run: pip install git+https://github.com/open-mmlab/[email protected]
48
+ - name: Install other dependencies
49
+ run: pip install -r requirements/tests.txt
50
+ - name: Build and install
51
+ run: rm -rf .eggs && pip install -e .
52
+ - name: Run unittests and generate coverage report
53
+ run: |
54
+ coverage run --branch --source mmocr -m pytest tests/
55
+ coverage xml
56
+ coverage report -m
57
+
58
+ build_cpu_pt:
59
+ runs-on: ubuntu-22.04
60
+ strategy:
61
+ matrix:
62
+ python-version: [3.7]
63
+ torch: [1.6.0, 1.7.1, 1.8.1, 1.9.1, 1.10.1, 1.11.0, 1.12.1, 1.13.0]
64
+ include:
65
+ - torch: 1.6.0
66
+ torchvision: 0.7.0
67
+ - torch: 1.7.1
68
+ torchvision: 0.8.2
69
+ - torch: 1.8.1
70
+ torchvision: 0.9.1
71
+ - torch: 1.9.1
72
+ torchvision: 0.10.1
73
+ - torch: 1.10.1
74
+ torchvision: 0.11.2
75
+ - torch: 1.11.0
76
+ torchvision: 0.12.0
77
+ - torch: 1.12.1
78
+ torchvision: 0.13.1
79
+ - torch: 1.13.0
80
+ torchvision: 0.14.0
81
+ - torch: 2.0.0
82
+ torchvision: 0.15.1
83
+ python-version: 3.8
84
+ steps:
85
+ - uses: actions/checkout@v3
86
+ - name: Set up Python ${{ matrix.python-version }}
87
+ uses: actions/setup-python@v4
88
+ with:
89
+ python-version: ${{ matrix.python-version }}
90
+ - name: Upgrade pip
91
+ run: pip install pip --upgrade
92
+ - name: Install PyTorch
93
+ run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
94
+ - name: Install MMEngine
95
+ run: pip install git+https://github.com/open-mmlab/mmengine.git@main
96
+ - name: Install MMCV
97
+ run: |
98
+ pip install -U openmim
99
+ mim install 'mmcv >= 2.0.0rc1'
100
+ - name: Install MMDet
101
+ run: pip install git+https://github.com/open-mmlab/[email protected]
102
+ - name: Install other dependencies
103
+ run: pip install -r requirements/tests.txt
104
+ - name: Build and install
105
+ run: rm -rf .eggs && pip install -e .
106
+ - name: Run unittests and generate coverage report
107
+ run: |
108
+ coverage run --branch --source mmocr -m pytest tests/
109
+ coverage xml
110
+ coverage report -m
111
+ # Only upload coverage report for python3.7 && pytorch1.8.1 cpu
112
+ - name: Upload coverage to Codecov
113
+ if: ${{matrix.torch == '1.8.1' && matrix.python-version == '3.7'}}
114
+ uses: codecov/[email protected]
115
+ with:
116
+ file: ./coverage.xml
117
+ flags: unittests
118
+ env_vars: OS,PYTHON
119
+ name: codecov-umbrella
120
+ fail_ci_if_error: false
121
+
122
+
123
+ build_windows:
124
+ runs-on: windows-2022
125
+ strategy:
126
+ matrix:
127
+ python: [3.7]
128
+ platform: [cpu, cu111]
129
+ torch: [1.8.1]
130
+ torchvision: [0.9.1]
131
+ include:
132
+ - python-version: 3.8
133
+ platform: cu117
134
+ torch: 2.0.0
135
+ torchvision: 0.15.1
136
+ steps:
137
+ - uses: actions/checkout@v2
138
+ - name: Set up Python ${{ matrix.python }}
139
+ uses: actions/setup-python@v2
140
+ with:
141
+ python-version: ${{ matrix.python }}
142
+ - name: Upgrade pip
143
+ run: python -m pip install --upgrade pip
144
+ - name: Install lmdb
145
+ run: pip install lmdb
146
+ - name: Install PyTorch
147
+ run: pip install torch==${{matrix.torch}}+${{matrix.platform}} torchvision==${{matrix.torchvision}}+${{matrix.platform}} -f https://download.pytorch.org/whl/${{matrix.platform}}/torch_stable.html
148
+ - name: Install mmocr dependencies
149
+ run: |
150
+ pip install git+https://github.com/open-mmlab/mmengine.git@main
151
+ pip install -U openmim
152
+ mim install 'mmcv >= 2.0.0rc1'
153
+ pip install git+https://github.com/open-mmlab/[email protected]
154
+ pip install -r requirements/tests.txt
155
+ - name: Build and install
156
+ run: |
157
+ pip install -e .
158
+ - name: Run unittests and generate coverage report
159
+ run: |
160
+ pytest tests/
mmocr-dev-1.x/.github/workflows/pr_stage_test.yml ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: pr_stage_test
2
+
3
+ on:
4
+ pull_request:
5
+ paths-ignore:
6
+ - 'README.md'
7
+ - 'README_zh-CN.md'
8
+ - 'docs/**'
9
+ - 'demo/**'
10
+ - '.dev_scripts/**'
11
+ - '.circleci/**'
12
+ - 'projects/**'
13
+
14
+ concurrency:
15
+ group: ${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ build_cpu:
20
+ runs-on: ubuntu-22.04
21
+ strategy:
22
+ matrix:
23
+ python-version: [3.7]
24
+ include:
25
+ - torch: 1.8.1
26
+ torchvision: 0.9.1
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - name: Set up Python ${{ matrix.python-version }}
30
+ uses: actions/setup-python@v4
31
+ with:
32
+ python-version: ${{ matrix.python-version }}
33
+ - name: Upgrade pip
34
+ run: pip install pip --upgrade
35
+ - name: Install PyTorch
36
+ run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
37
+ - name: Install MMEngine
38
+ run: pip install git+https://github.com/open-mmlab/mmengine.git@main
39
+ - name: Install MMCV
40
+ run: |
41
+ pip install -U openmim
42
+ mim install 'mmcv >= 2.0.0rc1'
43
+ - name: Install MMDet
44
+ run: pip install git+https://github.com/open-mmlab/[email protected]
45
+ - name: Install other dependencies
46
+ run: pip install -r requirements/tests.txt
47
+ - name: Build and install
48
+ run: rm -rf .eggs && pip install -e .
49
+ - name: Run unittests and generate coverage report
50
+ run: |
51
+ coverage run --branch --source mmocr -m pytest tests/
52
+ coverage xml
53
+ coverage report -m
54
+ # Upload coverage report for python3.7 && pytorch1.8.1 cpu
55
+ - name: Upload coverage to Codecov
56
+ uses: codecov/[email protected]
57
+ with:
58
+ file: ./coverage.xml
59
+ flags: unittests
60
+ env_vars: OS,PYTHON
61
+ name: codecov-umbrella
62
+ fail_ci_if_error: false
63
+
64
+
65
+ build_windows:
66
+ runs-on: windows-2022
67
+ strategy:
68
+ matrix:
69
+ python: [3.7]
70
+ platform: [cpu, cu111]
71
+ torch: [1.8.1]
72
+ torchvision: [0.9.1]
73
+ include:
74
+ - python-version: 3.8
75
+ platform: cu117
76
+ torch: 2.0.0
77
+ torchvision: 0.15.1
78
+ steps:
79
+ - uses: actions/checkout@v3
80
+ - name: Set up Python ${{ matrix.python }}
81
+ uses: actions/setup-python@v4
82
+ with:
83
+ python-version: ${{ matrix.python }}
84
+ - name: Upgrade pip
85
+ run: python -m pip install --upgrade pip
86
+ - name: Install lmdb
87
+ run: pip install lmdb
88
+ - name: Install PyTorch
89
+ run: pip install torch==${{matrix.torch}}+${{matrix.platform}} torchvision==${{matrix.torchvision}}+${{matrix.platform}} -f https://download.pytorch.org/whl/${{matrix.platform}}/torch_stable.html
90
+ - name: Install mmocr dependencies
91
+ run: |
92
+ pip install git+https://github.com/open-mmlab/mmengine.git@main
93
+ pip install -U openmim
94
+ mim install 'mmcv >= 2.0.0rc1'
95
+ pip install git+https://github.com/open-mmlab/[email protected]
96
+ pip install -r requirements/tests.txt
97
+ - name: Build and install
98
+ run: |
99
+ pip install -e .
100
+ - name: Run unittests and generate coverage report
101
+ run: |
102
+ pytest tests/
mmocr-dev-1.x/.github/workflows/publish-to-pypi.yml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: deploy
2
+
3
+ on: push
4
+
5
+ concurrency:
6
+ group: ${{ github.workflow }}-${{ github.ref }}
7
+ cancel-in-progress: true
8
+
9
+ jobs:
10
+ build-n-publish:
11
+ runs-on: ubuntu-latest
12
+ if: startsWith(github.event.ref, 'refs/tags')
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Python 3.7
16
+ uses: actions/setup-python@v1
17
+ with:
18
+ python-version: 3.7
19
+ - name: Build MMOCR
20
+ run: |
21
+ pip install wheel
22
+ python setup.py sdist bdist_wheel
23
+ - name: Publish distribution to PyPI
24
+ run: |
25
+ pip install twine
26
+ twine upload dist/* -u __token__ -p ${{ secrets.pypi_password }}
mmocr-dev-1.x/.github/workflows/test_mim.yml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: test-mim
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - 'model-index.yml'
7
+ - 'configs/**'
8
+
9
+ pull_request:
10
+ paths:
11
+ - 'model-index.yml'
12
+ - 'configs/**'
13
+
14
+ concurrency:
15
+ group: ${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ build_cpu:
20
+ runs-on: ubuntu-18.04
21
+ strategy:
22
+ matrix:
23
+ python-version: [3.7]
24
+ torch: [1.8.0]
25
+ include:
26
+ - torch: 1.8.0
27
+ torch_version: torch1.8
28
+ torchvision: 0.9.0
29
+ steps:
30
+ - uses: actions/checkout@v2
31
+ - name: Set up Python ${{ matrix.python-version }}
32
+ uses: actions/setup-python@v2
33
+ with:
34
+ python-version: ${{ matrix.python-version }}
35
+ - name: Upgrade pip
36
+ run: pip install pip --upgrade
37
+ - name: Install PyTorch
38
+ run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
39
+ - name: Install openmim
40
+ run: pip install openmim
41
+ - name: Build and install
42
+ run: rm -rf .eggs && mim install -e .
43
+ - name: test commands of mim
44
+ run: mim search mmocr
mmocr-dev-1.x/.gitignore ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.ipynb
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+
51
+ # Translations
52
+ *.mo
53
+ *.pot
54
+
55
+ # Django stuff:
56
+ *.log
57
+ local_settings.py
58
+ db.sqlite3
59
+
60
+ # Flask stuff:
61
+ instance/
62
+ .webassets-cache
63
+
64
+ # Scrapy stuff:
65
+ .scrapy
66
+
67
+ # Sphinx documentation
68
+ docs/en/_build/
69
+ docs/zh_cn/_build/
70
+ docs/*/api/generated/
71
+
72
+ # PyBuilder
73
+ target/
74
+
75
+ # Jupyter Notebook
76
+ .ipynb_checkpoints
77
+
78
+ # pyenv
79
+ .python-version
80
+
81
+ # celery beat schedule file
82
+ celerybeat-schedule
83
+
84
+ # SageMath parsed files
85
+ *.sage.py
86
+
87
+ # Environments
88
+ .env
89
+ .venv
90
+ env/
91
+ venv/
92
+ ENV/
93
+ env.bak/
94
+ venv.bak/
95
+
96
+ # Spyder project settings
97
+ .spyderproject
98
+ .spyproject
99
+
100
+ # Rope project settings
101
+ .ropeproject
102
+
103
+ # mkdocs documentation
104
+ /site
105
+
106
+ # mypy
107
+ .mypy_cache/
108
+
109
+ # cython generated cpp
110
+ !data/dict
111
+ /data
112
+ .vscode
113
+ .idea
114
+
115
+ # custom
116
+ *.pkl
117
+ *.pkl.json
118
+ *.log.json
119
+ work_dirs/
120
+ exps/
121
+ *~
122
+ show_dir/
123
+
124
+ # Pytorch
125
+ *.pth
126
+
127
+ # demo
128
+ !tests/data
129
+ tests/results
130
+
131
+ #temp files
132
+ .DS_Store
133
+
134
+ checkpoints
135
+
136
+ htmlcov
137
+ *.swp
138
+ log.txt
139
+ workspace.code-workspace
140
+ results
141
+ mmocr/core/font.TTF
142
+ mmocr/.mim
143
+ workdirs/
144
+ .history/
145
+ .dev/
146
+ data/
mmocr-dev-1.x/.owners.yml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ assign:
2
+ strategy:
3
+ random
4
+ # daily-shift-based
5
+ scedule:
6
+ '*/1 * * * *'
7
+ assignees:
8
+ - gaotongxiao
9
+ - Harold-lkk
mmocr-dev-1.x/.pre-commit-config.yaml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ exclude: ^tests/data/
2
+ repos:
3
+ - repo: https://github.com/PyCQA/flake8
4
+ rev: 5.0.4
5
+ hooks:
6
+ - id: flake8
7
+ - repo: https://github.com/zhouzaida/isort
8
+ rev: 5.12.1
9
+ hooks:
10
+ - id: isort
11
+ - repo: https://github.com/pre-commit/mirrors-yapf
12
+ rev: v0.32.0
13
+ hooks:
14
+ - id: yapf
15
+ - repo: https://github.com/codespell-project/codespell
16
+ rev: v2.2.1
17
+ hooks:
18
+ - id: codespell
19
+ - repo: https://github.com/pre-commit/pre-commit-hooks
20
+ rev: v4.3.0
21
+ hooks:
22
+ - id: trailing-whitespace
23
+ exclude: |
24
+ (?x)^(
25
+ dicts/|
26
+ projects/.*?/dicts/
27
+ )
28
+ - id: check-yaml
29
+ - id: end-of-file-fixer
30
+ exclude: |
31
+ (?x)^(
32
+ dicts/|
33
+ projects/.*?/dicts/
34
+ )
35
+ - id: requirements-txt-fixer
36
+ - id: double-quote-string-fixer
37
+ - id: check-merge-conflict
38
+ - id: fix-encoding-pragma
39
+ args: ["--remove"]
40
+ - id: mixed-line-ending
41
+ args: ["--fix=lf"]
42
+ - id: mixed-line-ending
43
+ args: ["--fix=lf"]
44
+ - repo: https://github.com/executablebooks/mdformat
45
+ rev: 0.7.9
46
+ hooks:
47
+ - id: mdformat
48
+ args: ["--number", "--table-width", "200"]
49
+ additional_dependencies:
50
+ - mdformat-openmmlab
51
+ - mdformat_frontmatter
52
+ - linkify-it-py
53
+ - repo: https://github.com/myint/docformatter
54
+ rev: v1.3.1
55
+ hooks:
56
+ - id: docformatter
57
+ args: ["--in-place", "--wrap-descriptions", "79"]
58
+ - repo: https://github.com/open-mmlab/pre-commit-hooks
59
+ rev: v0.2.0 # Use the ref you want to point at
60
+ hooks:
61
+ - id: check-algo-readme
62
+ - id: check-copyright
63
+ args: ["mmocr", "tests", "tools"] # these directories will be checked
mmocr-dev-1.x/.pylintrc ADDED
@@ -0,0 +1,621 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [MASTER]
2
+
3
+ # A comma-separated list of package or module names from where C extensions may
4
+ # be loaded. Extensions are loading into the active Python interpreter and may
5
+ # run arbitrary code.
6
+ extension-pkg-whitelist=
7
+
8
+ # Specify a score threshold to be exceeded before program exits with error.
9
+ fail-under=10.0
10
+
11
+ # Add files or directories to the blacklist. They should be base names, not
12
+ # paths.
13
+ ignore=CVS,configs
14
+
15
+ # Add files or directories matching the regex patterns to the blacklist. The
16
+ # regex matches against base names, not paths.
17
+ ignore-patterns=
18
+
19
+ # Python code to execute, usually for sys.path manipulation such as
20
+ # pygtk.require().
21
+ #init-hook=
22
+
23
+ # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
24
+ # number of processors available to use.
25
+ jobs=1
26
+
27
+ # Control the amount of potential inferred values when inferring a single
28
+ # object. This can help the performance when dealing with large functions or
29
+ # complex, nested conditions.
30
+ limit-inference-results=100
31
+
32
+ # List of plugins (as comma separated values of python module names) to load,
33
+ # usually to register additional checkers.
34
+ load-plugins=
35
+
36
+ # Pickle collected data for later comparisons.
37
+ persistent=yes
38
+
39
+ # When enabled, pylint would attempt to guess common misconfiguration and emit
40
+ # user-friendly hints instead of false-positive error messages.
41
+ suggestion-mode=yes
42
+
43
+ # Allow loading of arbitrary C extensions. Extensions are imported into the
44
+ # active Python interpreter and may run arbitrary code.
45
+ unsafe-load-any-extension=no
46
+
47
+
48
+ [MESSAGES CONTROL]
49
+
50
+ # Only show warnings with the listed confidence levels. Leave empty to show
51
+ # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
52
+ confidence=
53
+
54
+ # Disable the message, report, category or checker with the given id(s). You
55
+ # can either give multiple identifiers separated by comma (,) or put this
56
+ # option multiple times (only on the command line, not in the configuration
57
+ # file where it should appear only once). You can also use "--disable=all" to
58
+ # disable everything first and then reenable specific checks. For example, if
59
+ # you want to run only the similarities checker, you can use "--disable=all
60
+ # --enable=similarities". If you want to run only the classes checker, but have
61
+ # no Warning level messages displayed, use "--disable=all --enable=classes
62
+ # --disable=W".
63
+ disable=print-statement,
64
+ parameter-unpacking,
65
+ unpacking-in-except,
66
+ old-raise-syntax,
67
+ backtick,
68
+ long-suffix,
69
+ old-ne-operator,
70
+ old-octal-literal,
71
+ import-star-module-level,
72
+ non-ascii-bytes-literal,
73
+ raw-checker-failed,
74
+ bad-inline-option,
75
+ locally-disabled,
76
+ file-ignored,
77
+ suppressed-message,
78
+ useless-suppression,
79
+ deprecated-pragma,
80
+ use-symbolic-message-instead,
81
+ apply-builtin,
82
+ basestring-builtin,
83
+ buffer-builtin,
84
+ cmp-builtin,
85
+ coerce-builtin,
86
+ execfile-builtin,
87
+ file-builtin,
88
+ long-builtin,
89
+ raw_input-builtin,
90
+ reduce-builtin,
91
+ standarderror-builtin,
92
+ unicode-builtin,
93
+ xrange-builtin,
94
+ coerce-method,
95
+ delslice-method,
96
+ getslice-method,
97
+ setslice-method,
98
+ no-absolute-import,
99
+ old-division,
100
+ dict-iter-method,
101
+ dict-view-method,
102
+ next-method-called,
103
+ metaclass-assignment,
104
+ indexing-exception,
105
+ raising-string,
106
+ reload-builtin,
107
+ oct-method,
108
+ hex-method,
109
+ nonzero-method,
110
+ cmp-method,
111
+ input-builtin,
112
+ round-builtin,
113
+ intern-builtin,
114
+ unichr-builtin,
115
+ map-builtin-not-iterating,
116
+ zip-builtin-not-iterating,
117
+ range-builtin-not-iterating,
118
+ filter-builtin-not-iterating,
119
+ using-cmp-argument,
120
+ eq-without-hash,
121
+ div-method,
122
+ idiv-method,
123
+ rdiv-method,
124
+ exception-message-attribute,
125
+ invalid-str-codec,
126
+ sys-max-int,
127
+ bad-python3-import,
128
+ deprecated-string-function,
129
+ deprecated-str-translate-call,
130
+ deprecated-itertools-function,
131
+ deprecated-types-field,
132
+ next-method-defined,
133
+ dict-items-not-iterating,
134
+ dict-keys-not-iterating,
135
+ dict-values-not-iterating,
136
+ deprecated-operator-function,
137
+ deprecated-urllib-function,
138
+ xreadlines-attribute,
139
+ deprecated-sys-function,
140
+ exception-escape,
141
+ comprehension-escape,
142
+ no-member,
143
+ invalid-name,
144
+ too-many-branches,
145
+ wrong-import-order,
146
+ too-many-arguments,
147
+ missing-function-docstring,
148
+ missing-module-docstring,
149
+ too-many-locals,
150
+ too-few-public-methods,
151
+ abstract-method,
152
+ broad-except,
153
+ too-many-nested-blocks,
154
+ too-many-instance-attributes,
155
+ missing-class-docstring,
156
+ duplicate-code,
157
+ not-callable,
158
+ protected-access,
159
+ dangerous-default-value,
160
+ no-name-in-module,
161
+ logging-fstring-interpolation,
162
+ super-init-not-called,
163
+ redefined-builtin,
164
+ attribute-defined-outside-init,
165
+ arguments-differ,
166
+ cyclic-import,
167
+ bad-super-call,
168
+ too-many-statements
169
+
170
+ # Enable the message, report, category or checker with the given id(s). You can
171
+ # either give multiple identifier separated by comma (,) or put this option
172
+ # multiple time (only on the command line, not in the configuration file where
173
+ # it should appear only once). See also the "--disable" option for examples.
174
+ enable=c-extension-no-member
175
+
176
+
177
+ [REPORTS]
178
+
179
+ # Python expression which should return a score less than or equal to 10. You
180
+ # have access to the variables 'error', 'warning', 'refactor', and 'convention'
181
+ # which contain the number of messages in each category, as well as 'statement'
182
+ # which is the total number of statements analyzed. This score is used by the
183
+ # global evaluation report (RP0004).
184
+ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
185
+
186
+ # Template used to display messages. This is a python new-style format string
187
+ # used to format the message information. See doc for all details.
188
+ #msg-template=
189
+
190
+ # Set the output format. Available formats are text, parseable, colorized, json
191
+ # and msvs (visual studio). You can also give a reporter class, e.g.
192
+ # mypackage.mymodule.MyReporterClass.
193
+ output-format=text
194
+
195
+ # Tells whether to display a full report or only the messages.
196
+ reports=no
197
+
198
+ # Activate the evaluation score.
199
+ score=yes
200
+
201
+
202
+ [REFACTORING]
203
+
204
+ # Maximum number of nested blocks for function / method body
205
+ max-nested-blocks=5
206
+
207
+ # Complete name of functions that never returns. When checking for
208
+ # inconsistent-return-statements if a never returning function is called then
209
+ # it will be considered as an explicit return statement and no message will be
210
+ # printed.
211
+ never-returning-functions=sys.exit
212
+
213
+
214
+ [TYPECHECK]
215
+
216
+ # List of decorators that produce context managers, such as
217
+ # contextlib.contextmanager. Add to this list to register other decorators that
218
+ # produce valid context managers.
219
+ contextmanager-decorators=contextlib.contextmanager
220
+
221
+ # List of members which are set dynamically and missed by pylint inference
222
+ # system, and so shouldn't trigger E1101 when accessed. Python regular
223
+ # expressions are accepted.
224
+ generated-members=
225
+
226
+ # Tells whether missing members accessed in mixin class should be ignored. A
227
+ # mixin class is detected if its name ends with "mixin" (case insensitive).
228
+ ignore-mixin-members=yes
229
+
230
+ # Tells whether to warn about missing members when the owner of the attribute
231
+ # is inferred to be None.
232
+ ignore-none=yes
233
+
234
+ # This flag controls whether pylint should warn about no-member and similar
235
+ # checks whenever an opaque object is returned when inferring. The inference
236
+ # can return multiple potential results while evaluating a Python object, but
237
+ # some branches might not be evaluated, which results in partial inference. In
238
+ # that case, it might be useful to still emit no-member and other checks for
239
+ # the rest of the inferred objects.
240
+ ignore-on-opaque-inference=yes
241
+
242
+ # List of class names for which member attributes should not be checked (useful
243
+ # for classes with dynamically set attributes). This supports the use of
244
+ # qualified names.
245
+ ignored-classes=optparse.Values,thread._local,_thread._local
246
+
247
+ # List of module names for which member attributes should not be checked
248
+ # (useful for modules/projects where namespaces are manipulated during runtime
249
+ # and thus existing member attributes cannot be deduced by static analysis). It
250
+ # supports qualified module names, as well as Unix pattern matching.
251
+ ignored-modules=
252
+
253
+ # Show a hint with possible names when a member name was not found. The aspect
254
+ # of finding the hint is based on edit distance.
255
+ missing-member-hint=yes
256
+
257
+ # The minimum edit distance a name should have in order to be considered a
258
+ # similar match for a missing member name.
259
+ missing-member-hint-distance=1
260
+
261
+ # The total number of similar names that should be taken in consideration when
262
+ # showing a hint for a missing member.
263
+ missing-member-max-choices=1
264
+
265
+ # List of decorators that change the signature of a decorated function.
266
+ signature-mutators=
267
+
268
+
269
+ [SPELLING]
270
+
271
+ # Limits count of emitted suggestions for spelling mistakes.
272
+ max-spelling-suggestions=4
273
+
274
+ # Spelling dictionary name. Available dictionaries: none. To make it work,
275
+ # install the python-enchant package.
276
+ spelling-dict=
277
+
278
+ # List of comma separated words that should not be checked.
279
+ spelling-ignore-words=
280
+
281
+ # A path to a file that contains the private dictionary; one word per line.
282
+ spelling-private-dict-file=
283
+
284
+ # Tells whether to store unknown words to the private dictionary (see the
285
+ # --spelling-private-dict-file option) instead of raising a message.
286
+ spelling-store-unknown-words=no
287
+
288
+
289
+ [LOGGING]
290
+
291
+ # The type of string formatting that logging methods do. `old` means using %
292
+ # formatting, `new` is for `{}` formatting.
293
+ logging-format-style=old
294
+
295
+ # Logging modules to check that the string format arguments are in logging
296
+ # function parameter format.
297
+ logging-modules=logging
298
+
299
+
300
+ [VARIABLES]
301
+
302
+ # List of additional names supposed to be defined in builtins. Remember that
303
+ # you should avoid defining new builtins when possible.
304
+ additional-builtins=
305
+
306
+ # Tells whether unused global variables should be treated as a violation.
307
+ allow-global-unused-variables=yes
308
+
309
+ # List of strings which can identify a callback function by name. A callback
310
+ # name must start or end with one of those strings.
311
+ callbacks=cb_,
312
+ _cb
313
+
314
+ # A regular expression matching the name of dummy variables (i.e. expected to
315
+ # not be used).
316
+ dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
317
+
318
+ # Argument names that match this expression will be ignored. Default to name
319
+ # with leading underscore.
320
+ ignored-argument-names=_.*|^ignored_|^unused_
321
+
322
+ # Tells whether we should check for unused import in __init__ files.
323
+ init-import=no
324
+
325
+ # List of qualified module names which can have objects that can redefine
326
+ # builtins.
327
+ redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
328
+
329
+
330
+ [FORMAT]
331
+
332
+ # Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
333
+ expected-line-ending-format=
334
+
335
+ # Regexp for a line that is allowed to be longer than the limit.
336
+ ignore-long-lines=^\s*(# )?<?https?://\S+>?$
337
+
338
+ # Number of spaces of indent required inside a hanging or continued line.
339
+ indent-after-paren=4
340
+
341
+ # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
342
+ # tab).
343
+ indent-string=' '
344
+
345
+ # Maximum number of characters on a single line.
346
+ max-line-length=100
347
+
348
+ # Maximum number of lines in a module.
349
+ max-module-lines=1000
350
+
351
+ # Allow the body of a class to be on the same line as the declaration if body
352
+ # contains single statement.
353
+ single-line-class-stmt=no
354
+
355
+ # Allow the body of an if to be on the same line as the test if there is no
356
+ # else.
357
+ single-line-if-stmt=no
358
+
359
+
360
+ [STRING]
361
+
362
+ # This flag controls whether inconsistent-quotes generates a warning when the
363
+ # character used as a quote delimiter is used inconsistently within a module.
364
+ check-quote-consistency=no
365
+
366
+ # This flag controls whether the implicit-str-concat should generate a warning
367
+ # on implicit string concatenation in sequences defined over several lines.
368
+ check-str-concat-over-line-jumps=no
369
+
370
+
371
+ [SIMILARITIES]
372
+
373
+ # Ignore comments when computing similarities.
374
+ ignore-comments=yes
375
+
376
+ # Ignore docstrings when computing similarities.
377
+ ignore-docstrings=yes
378
+
379
+ # Ignore imports when computing similarities.
380
+ ignore-imports=no
381
+
382
+ # Minimum lines number of a similarity.
383
+ min-similarity-lines=4
384
+
385
+
386
+ [MISCELLANEOUS]
387
+
388
+ # List of note tags to take in consideration, separated by a comma.
389
+ notes=FIXME,
390
+ XXX,
391
+ TODO
392
+
393
+ # Regular expression of note tags to take in consideration.
394
+ #notes-rgx=
395
+
396
+
397
+ [BASIC]
398
+
399
+ # Naming style matching correct argument names.
400
+ argument-naming-style=snake_case
401
+
402
+ # Regular expression matching correct argument names. Overrides argument-
403
+ # naming-style.
404
+ #argument-rgx=
405
+
406
+ # Naming style matching correct attribute names.
407
+ attr-naming-style=snake_case
408
+
409
+ # Regular expression matching correct attribute names. Overrides attr-naming-
410
+ # style.
411
+ #attr-rgx=
412
+
413
+ # Bad variable names which should always be refused, separated by a comma.
414
+ bad-names=foo,
415
+ bar,
416
+ baz,
417
+ toto,
418
+ tutu,
419
+ tata
420
+
421
+ # Bad variable names regexes, separated by a comma. If names match any regex,
422
+ # they will always be refused
423
+ bad-names-rgxs=
424
+
425
+ # Naming style matching correct class attribute names.
426
+ class-attribute-naming-style=any
427
+
428
+ # Regular expression matching correct class attribute names. Overrides class-
429
+ # attribute-naming-style.
430
+ #class-attribute-rgx=
431
+
432
+ # Naming style matching correct class names.
433
+ class-naming-style=PascalCase
434
+
435
+ # Regular expression matching correct class names. Overrides class-naming-
436
+ # style.
437
+ #class-rgx=
438
+
439
+ # Naming style matching correct constant names.
440
+ const-naming-style=UPPER_CASE
441
+
442
+ # Regular expression matching correct constant names. Overrides const-naming-
443
+ # style.
444
+ #const-rgx=
445
+
446
+ # Minimum line length for functions/classes that require docstrings, shorter
447
+ # ones are exempt.
448
+ docstring-min-length=-1
449
+
450
+ # Naming style matching correct function names.
451
+ function-naming-style=snake_case
452
+
453
+ # Regular expression matching correct function names. Overrides function-
454
+ # naming-style.
455
+ #function-rgx=
456
+
457
+ # Good variable names which should always be accepted, separated by a comma.
458
+ good-names=i,
459
+ j,
460
+ k,
461
+ ex,
462
+ Run,
463
+ _,
464
+ x,
465
+ y,
466
+ w,
467
+ h,
468
+ a,
469
+ b
470
+
471
+ # Good variable names regexes, separated by a comma. If names match any regex,
472
+ # they will always be accepted
473
+ good-names-rgxs=
474
+
475
+ # Include a hint for the correct naming format with invalid-name.
476
+ include-naming-hint=no
477
+
478
+ # Naming style matching correct inline iteration names.
479
+ inlinevar-naming-style=any
480
+
481
+ # Regular expression matching correct inline iteration names. Overrides
482
+ # inlinevar-naming-style.
483
+ #inlinevar-rgx=
484
+
485
+ # Naming style matching correct method names.
486
+ method-naming-style=snake_case
487
+
488
+ # Regular expression matching correct method names. Overrides method-naming-
489
+ # style.
490
+ #method-rgx=
491
+
492
+ # Naming style matching correct module names.
493
+ module-naming-style=snake_case
494
+
495
+ # Regular expression matching correct module names. Overrides module-naming-
496
+ # style.
497
+ #module-rgx=
498
+
499
+ # Colon-delimited sets of names that determine each other's naming style when
500
+ # the name regexes allow several styles.
501
+ name-group=
502
+
503
+ # Regular expression which should only match function or class names that do
504
+ # not require a docstring.
505
+ no-docstring-rgx=^_
506
+
507
+ # List of decorators that produce properties, such as abc.abstractproperty. Add
508
+ # to this list to register other decorators that produce valid properties.
509
+ # These decorators are taken in consideration only for invalid-name.
510
+ property-classes=abc.abstractproperty
511
+
512
+ # Naming style matching correct variable names.
513
+ variable-naming-style=snake_case
514
+
515
+ # Regular expression matching correct variable names. Overrides variable-
516
+ # naming-style.
517
+ #variable-rgx=
518
+
519
+
520
+ [DESIGN]
521
+
522
+ # Maximum number of arguments for function / method.
523
+ max-args=5
524
+
525
+ # Maximum number of attributes for a class (see R0902).
526
+ max-attributes=7
527
+
528
+ # Maximum number of boolean expressions in an if statement (see R0916).
529
+ max-bool-expr=5
530
+
531
+ # Maximum number of branch for function / method body.
532
+ max-branches=12
533
+
534
+ # Maximum number of locals for function / method body.
535
+ max-locals=15
536
+
537
+ # Maximum number of parents for a class (see R0901).
538
+ max-parents=7
539
+
540
+ # Maximum number of public methods for a class (see R0904).
541
+ max-public-methods=20
542
+
543
+ # Maximum number of return / yield for function / method body.
544
+ max-returns=6
545
+
546
+ # Maximum number of statements in function / method body.
547
+ max-statements=50
548
+
549
+ # Minimum number of public methods for a class (see R0903).
550
+ min-public-methods=2
551
+
552
+
553
+ [IMPORTS]
554
+
555
+ # List of modules that can be imported at any level, not just the top level
556
+ # one.
557
+ allow-any-import-level=
558
+
559
+ # Allow wildcard imports from modules that define __all__.
560
+ allow-wildcard-with-all=no
561
+
562
+ # Analyse import fallback blocks. This can be used to support both Python 2 and
563
+ # 3 compatible code, which means that the block might have code that exists
564
+ # only in one or another interpreter, leading to false positives when analysed.
565
+ analyse-fallback-blocks=no
566
+
567
+ # Deprecated modules which should not be used, separated by a comma.
568
+ deprecated-modules=optparse,tkinter.tix
569
+
570
+ # Create a graph of external dependencies in the given file (report RP0402 must
571
+ # not be disabled).
572
+ ext-import-graph=
573
+
574
+ # Create a graph of every (i.e. internal and external) dependencies in the
575
+ # given file (report RP0402 must not be disabled).
576
+ import-graph=
577
+
578
+ # Create a graph of internal dependencies in the given file (report RP0402 must
579
+ # not be disabled).
580
+ int-import-graph=
581
+
582
+ # Force import order to recognize a module as part of the standard
583
+ # compatibility libraries.
584
+ known-standard-library=
585
+
586
+ # Force import order to recognize a module as part of a third party library.
587
+ known-third-party=enchant
588
+
589
+ # Couples of modules and preferred modules, separated by a comma.
590
+ preferred-modules=
591
+
592
+
593
+ [CLASSES]
594
+
595
+ # List of method names used to declare (i.e. assign) instance attributes.
596
+ defining-attr-methods=__init__,
597
+ __new__,
598
+ setUp,
599
+ __post_init__
600
+
601
+ # List of member names, which should be excluded from the protected access
602
+ # warning.
603
+ exclude-protected=_asdict,
604
+ _fields,
605
+ _replace,
606
+ _source,
607
+ _make
608
+
609
+ # List of valid names for the first argument in a class method.
610
+ valid-classmethod-first-arg=cls
611
+
612
+ # List of valid names for the first argument in a metaclass class method.
613
+ valid-metaclass-classmethod-first-arg=cls
614
+
615
+
616
+ [EXCEPTIONS]
617
+
618
+ # Exceptions that will emit a warning when being caught. Defaults to
619
+ # "BaseException, Exception".
620
+ overgeneral-exceptions=BaseException,
621
+ Exception
mmocr-dev-1.x/.readthedocs.yml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ version: 2
2
+
3
+ formats: all
4
+
5
+ python:
6
+ version: 3.7
7
+ install:
8
+ - requirements: requirements/docs.txt
9
+ - requirements: requirements/readthedocs.txt
mmocr-dev-1.x/CITATION.cff ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ title: "OpenMMLab Text Detection, Recognition and Understanding Toolbox"
4
+ authors:
5
+ - name: "MMOCR Contributors"
6
+ version: 0.3.0
7
+ date-released: 2020-08-15
8
+ repository-code: "https://github.com/open-mmlab/mmocr"
9
+ license: Apache-2.0
mmocr-dev-1.x/LICENSE ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) MMOCR Authors. All rights reserved.
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright 2021 MMOCR Authors. All rights reserved.
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
mmocr-dev-1.x/MANIFEST.in ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ include requirements/*.txt
2
+ include mmocr/.mim/model-index.yml
3
+ include mmocr/.mim/dicts/*.txt
4
+ recursive-include mmocr/.mim/configs *.py *.yml
5
+ recursive-include mmocr/.mim/tools *.sh *.py
mmocr-dev-1.x/README.md ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <img src="resources/mmocr-logo.png" width="500px"/>
3
+ <div>&nbsp;</div>
4
+ <div align="center">
5
+ <b><font size="5">OpenMMLab website</font></b>
6
+ <sup>
7
+ <a href="https://openmmlab.com">
8
+ <i><font size="4">HOT</font></i>
9
+ </a>
10
+ </sup>
11
+ &nbsp;&nbsp;&nbsp;&nbsp;
12
+ <b><font size="5">OpenMMLab platform</font></b>
13
+ <sup>
14
+ <a href="https://platform.openmmlab.com">
15
+ <i><font size="4">TRY IT OUT</font></i>
16
+ </a>
17
+ </sup>
18
+ </div>
19
+ <div>&nbsp;</div>
20
+
21
+ [![build](https://github.com/open-mmlab/mmocr/workflows/build/badge.svg)](https://github.com/open-mmlab/mmocr/actions)
22
+ [![docs](https://readthedocs.org/projects/mmocr/badge/?version=dev-1.x)](https://mmocr.readthedocs.io/en/dev-1.x/?badge=dev-1.x)
23
+ [![codecov](https://codecov.io/gh/open-mmlab/mmocr/branch/main/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmocr)
24
+ [![license](https://img.shields.io/github/license/open-mmlab/mmocr.svg)](https://github.com/open-mmlab/mmocr/blob/main/LICENSE)
25
+ [![PyPI](https://badge.fury.io/py/mmocr.svg)](https://pypi.org/project/mmocr/)
26
+ [![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/open-mmlab/mmocr.svg)](https://github.com/open-mmlab/mmocr/issues)
27
+ [![Percentage of issues still open](https://isitmaintained.com/badge/open/open-mmlab/mmocr.svg)](https://github.com/open-mmlab/mmocr/issues)
28
+ <a href="https://console.tiyaro.ai/explore?q=mmocr&pub=mmocr"> <img src="https://tiyaro-public-docs.s3.us-west-2.amazonaws.com/assets/try_on_tiyaro_badge.svg"></a>
29
+
30
+ [📘Documentation](https://mmocr.readthedocs.io/en/dev-1.x/) |
31
+ [🛠️Installation](https://mmocr.readthedocs.io/en/dev-1.x/get_started/install.html) |
32
+ [👀Model Zoo](https://mmocr.readthedocs.io/en/dev-1.x/modelzoo.html) |
33
+ [🆕Update News](https://mmocr.readthedocs.io/en/dev-1.x/notes/changelog.html) |
34
+ [🤔Reporting Issues](https://github.com/open-mmlab/mmocr/issues/new/choose)
35
+
36
+ </div>
37
+
38
+ <div align="center">
39
+
40
+ English | [简体中文](README_zh-CN.md)
41
+
42
+ </div>
43
+ <div align="center">
44
+ <a href="https://openmmlab.medium.com/" style="text-decoration:none;">
45
+ <img src="https://user-images.githubusercontent.com/25839884/219255827-67c1a27f-f8c5-46a9-811d-5e57448c61d1.png" width="3%" alt="" /></a>
46
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
47
+ <a href="https://discord.gg/raweFPmdzG" style="text-decoration:none;">
48
+ <img src="https://user-images.githubusercontent.com/25839884/218347213-c080267f-cbb6-443e-8532-8e1ed9a58ea9.png" width="3%" alt="" /></a>
49
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
50
+ <a href="https://twitter.com/OpenMMLab" style="text-decoration:none;">
51
+ <img src="https://user-images.githubusercontent.com/25839884/218346637-d30c8a0f-3eba-4699-8131-512fb06d46db.png" width="3%" alt="" /></a>
52
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
53
+ <a href="https://www.youtube.com/openmmlab" style="text-decoration:none;">
54
+ <img src="https://user-images.githubusercontent.com/25839884/218346691-ceb2116a-465a-40af-8424-9f30d2348ca9.png" width="3%" alt="" /></a>
55
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
56
+ <a href="https://space.bilibili.com/1293512903" style="text-decoration:none;">
57
+ <img src="https://user-images.githubusercontent.com/25839884/219026751-d7d14cce-a7c9-4e82-9942-8375fca65b99.png" width="3%" alt="" /></a>
58
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
59
+ <a href="https://www.zhihu.com/people/openmmlab" style="text-decoration:none;">
60
+ <img src="https://user-images.githubusercontent.com/25839884/219026120-ba71e48b-6e94-4bd4-b4e9-b7d175b5e362.png" width="3%" alt="" /></a>
61
+ </div>
62
+
63
+ ## Latest Updates
64
+
65
+ **The default branch is now `main` and the code on the branch has been upgraded to v1.0.0. The old `main` branch (v0.6.3) code now exists on the `0.x` branch.** If you have been using the `main` branch and encounter upgrade issues, please read the [Migration Guide](https://mmocr.readthedocs.io/en/dev-1.x/migration/overview.html) and notes on [Branches](https://mmocr.readthedocs.io/en/dev-1.x/migration/branches.html) .
66
+
67
+ v1.0.0 was released in 2023-04-06. Major updates from 1.0.0rc6 include:
68
+
69
+ 1. Support for SCUT-CTW1500, SynthText, and MJSynth datasets in Dataset Preparer
70
+ 2. Updated FAQ and documentation
71
+ 3. Deprecation of file_client_args in favor of backend_args
72
+ 4. Added a new MMOCR tutorial notebook
73
+
74
+ To know more about the updates in MMOCR 1.0, please refer to [What's New in MMOCR 1.x](https://mmocr.readthedocs.io/en/dev-1.x/migration/news.html), or
75
+ Read [Changelog](https://mmocr.readthedocs.io/en/dev-1.x/notes/changelog.html) for more details!
76
+
77
+ ## Introduction
78
+
79
+ MMOCR is an open-source toolbox based on PyTorch and mmdetection for text detection, text recognition, and the corresponding downstream tasks including key information extraction. It is part of the [OpenMMLab](https://openmmlab.com/) project.
80
+
81
+ The main branch works with **PyTorch 1.6+**.
82
+
83
+ <div align="center">
84
+ <img src="https://user-images.githubusercontent.com/24622904/187838618-1fdc61c0-2d46-49f9-8502-976ffdf01f28.png"/>
85
+ </div>
86
+
87
+ ### Major Features
88
+
89
+ - **Comprehensive Pipeline**
90
+
91
+ The toolbox supports not only text detection and text recognition, but also their downstream tasks such as key information extraction.
92
+
93
+ - **Multiple Models**
94
+
95
+ The toolbox supports a wide variety of state-of-the-art models for text detection, text recognition and key information extraction.
96
+
97
+ - **Modular Design**
98
+
99
+ The modular design of MMOCR enables users to define their own optimizers, data preprocessors, and model components such as backbones, necks and heads as well as losses. Please refer to [Overview](https://mmocr.readthedocs.io/en/dev-1.x/get_started/overview.html) for how to construct a customized model.
100
+
101
+ - **Numerous Utilities**
102
+
103
+ The toolbox provides a comprehensive set of utilities which can help users assess the performance of models. It includes visualizers which allow visualization of images, ground truths as well as predicted bounding boxes, and a validation tool for evaluating checkpoints during training. It also includes data converters to demonstrate how to convert your own data to the annotation files which the toolbox supports.
104
+
105
+ ## Installation
106
+
107
+ MMOCR depends on [PyTorch](https://pytorch.org/), [MMEngine](https://github.com/open-mmlab/mmengine), [MMCV](https://github.com/open-mmlab/mmcv) and [MMDetection](https://github.com/open-mmlab/mmdetection).
108
+ Below are quick steps for installation.
109
+ Please refer to [Install Guide](https://mmocr.readthedocs.io/en/dev-1.x/get_started/install.html) for more detailed instruction.
110
+
111
+ ```shell
112
+ conda create -n open-mmlab python=3.8 pytorch=1.10 cudatoolkit=11.3 torchvision -c pytorch -y
113
+ conda activate open-mmlab
114
+ pip3 install openmim
115
+ git clone https://github.com/open-mmlab/mmocr.git
116
+ cd mmocr
117
+ mim install -e .
118
+ ```
119
+
120
+ ## Get Started
121
+
122
+ Please see [Quick Run](https://mmocr.readthedocs.io/en/dev-1.x/get_started/quick_run.html) for the basic usage of MMOCR.
123
+
124
+ ## [Model Zoo](https://mmocr.readthedocs.io/en/dev-1.x/modelzoo.html)
125
+
126
+ Supported algorithms:
127
+
128
+ <details open>
129
+ <summary>BackBone</summary>
130
+
131
+ - [x] [oCLIP](configs/backbone/oclip/README.md) (ECCV'2022)
132
+
133
+ </details>
134
+
135
+ <details open>
136
+ <summary>Text Detection</summary>
137
+
138
+ - [x] [DBNet](configs/textdet/dbnet/README.md) (AAAI'2020) / [DBNet++](configs/textdet/dbnetpp/README.md) (TPAMI'2022)
139
+ - [x] [Mask R-CNN](configs/textdet/maskrcnn/README.md) (ICCV'2017)
140
+ - [x] [PANet](configs/textdet/panet/README.md) (ICCV'2019)
141
+ - [x] [PSENet](configs/textdet/psenet/README.md) (CVPR'2019)
142
+ - [x] [TextSnake](configs/textdet/textsnake/README.md) (ECCV'2018)
143
+ - [x] [DRRG](configs/textdet/drrg/README.md) (CVPR'2020)
144
+ - [x] [FCENet](configs/textdet/fcenet/README.md) (CVPR'2021)
145
+
146
+ </details>
147
+
148
+ <details open>
149
+ <summary>Text Recognition</summary>
150
+
151
+ - [x] [ABINet](configs/textrecog/abinet/README.md) (CVPR'2021)
152
+ - [x] [ASTER](configs/textrecog/aster/README.md) (TPAMI'2018)
153
+ - [x] [CRNN](configs/textrecog/crnn/README.md) (TPAMI'2016)
154
+ - [x] [MASTER](configs/textrecog/master/README.md) (PR'2021)
155
+ - [x] [NRTR](configs/textrecog/nrtr/README.md) (ICDAR'2019)
156
+ - [x] [RobustScanner](configs/textrecog/robust_scanner/README.md) (ECCV'2020)
157
+ - [x] [SAR](configs/textrecog/sar/README.md) (AAAI'2019)
158
+ - [x] [SATRN](configs/textrecog/satrn/README.md) (CVPR'2020 Workshop on Text and Documents in the Deep Learning Era)
159
+ - [x] [SVTR](configs/textrecog/svtr/README.md) (IJCAI'2022)
160
+
161
+ </details>
162
+
163
+ <details open>
164
+ <summary>Key Information Extraction</summary>
165
+
166
+ - [x] [SDMG-R](configs/kie/sdmgr/README.md) (ArXiv'2021)
167
+
168
+ </details>
169
+
170
+ <details open>
171
+ <summary>Text Spotting</summary>
172
+
173
+ - [x] [ABCNet](projects/ABCNet/README.md) (CVPR'2020)
174
+ - [x] [ABCNetV2](projects/ABCNet/README_V2.md) (TPAMI'2021)
175
+ - [x] [SPTS](projects/SPTS/README.md) (ACM MM'2022)
176
+
177
+ </details>
178
+
179
+ Please refer to [model_zoo](https://mmocr.readthedocs.io/en/dev-1.x/modelzoo.html) for more details.
180
+
181
+ ## Projects
182
+
183
+ [Here](projects/README.md) are some implementations of SOTA models and solutions built on MMOCR, which are supported and maintained by community users. These projects demonstrate the best practices based on MMOCR for research and product development. We welcome and appreciate all the contributions to OpenMMLab ecosystem.
184
+
185
+ ## Contributing
186
+
187
+ We appreciate all contributions to improve MMOCR. Please refer to [CONTRIBUTING.md](.github/CONTRIBUTING.md) for the contributing guidelines.
188
+
189
+ ## Acknowledgement
190
+
191
+ MMOCR is an open-source project that is contributed by researchers and engineers from various colleges and companies. We appreciate all the contributors who implement their methods or add new features, as well as users who give valuable feedbacks.
192
+ We hope the toolbox and benchmark could serve the growing research community by providing a flexible toolkit to reimplement existing methods and develop their own new OCR methods.
193
+
194
+ ## Citation
195
+
196
+ If you find this project useful in your research, please consider cite:
197
+
198
+ ```bibtex
199
+ @article{mmocr2021,
200
+ title={MMOCR: A Comprehensive Toolbox for Text Detection, Recognition and Understanding},
201
+ author={Kuang, Zhanghui and Sun, Hongbin and Li, Zhizhong and Yue, Xiaoyu and Lin, Tsui Hin and Chen, Jianyong and Wei, Huaqiang and Zhu, Yiqin and Gao, Tong and Zhang, Wenwei and Chen, Kai and Zhang, Wayne and Lin, Dahua},
202
+ journal= {arXiv preprint arXiv:2108.06543},
203
+ year={2021}
204
+ }
205
+ ```
206
+
207
+ ## License
208
+
209
+ This project is released under the [Apache 2.0 license](LICENSE).
210
+
211
+ ## OpenMMLab Family
212
+
213
+ - [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab foundational library for training deep learning models
214
+ - [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab foundational library for computer vision.
215
+ - [MIM](https://github.com/open-mmlab/mim): MIM installs OpenMMLab packages.
216
+ - [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab image classification toolbox and benchmark.
217
+ - [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark.
218
+ - [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection.
219
+ - [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab rotated object detection toolbox and benchmark.
220
+ - [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark.
221
+ - [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab text detection, recognition, and understanding toolbox.
222
+ - [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark.
223
+ - [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 3D human parametric model toolbox and benchmark.
224
+ - [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab self-supervised learning toolbox and benchmark.
225
+ - [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab model compression toolbox and benchmark.
226
+ - [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab fewshot learning toolbox and benchmark.
227
+ - [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark.
228
+ - [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark.
229
+ - [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab optical flow toolbox and benchmark.
230
+ - [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
231
+ - [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab image and video generative models toolbox.
232
+ - [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab model deployment framework.
233
+
234
+ ## Welcome to the OpenMMLab community
235
+
236
+ Scan the QR code below to follow the OpenMMLab team's [**Zhihu Official Account**](https://www.zhihu.com/people/openmmlab) and join the OpenMMLab team's [**QQ Group**](https://jq.qq.com/?_wv=1027&k=aCvMxdr3), or join the official communication WeChat group by adding the WeChat, or join our [**Slack**](https://join.slack.com/t/mmocrworkspace/shared_invite/zt-1ifqhfla8-yKnLO_aKhVA2h71OrK8GZw)
237
+
238
+ <div align="center">
239
+ <img src="https://raw.githubusercontent.com/open-mmlab/mmcv/master/docs/en/_static/zhihu_qrcode.jpg" height="400" /> <img src="https://raw.githubusercontent.com/open-mmlab/mmcv/master/docs/en/_static/qq_group_qrcode.jpg" height="400" /> <img src="https://raw.githubusercontent.com/open-mmlab/mmcv/master/docs/en/_static/wechat_qrcode.jpg" height="400" />
240
+ </div>
241
+
242
+ We will provide you with the OpenMMLab community
243
+
244
+ - 📢 share the latest core technologies of AI frameworks
245
+ - 💻 Explaining PyTorch common module source Code
246
+ - 📰 News related to the release of OpenMMLab
247
+ - 🚀 Introduction of cutting-edge algorithms developed by OpenMMLab
248
+ 🏃 Get the more efficient answer and feedback
249
+ - 🔥 Provide a platform for communication with developers from all walks of life
250
+
251
+ The OpenMMLab community looks forward to your participation! 👬
mmocr-dev-1.x/README_zh-CN.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <img src="resources/mmocr-logo.png" width="500px"/>
3
+ <div>&nbsp;</div>
4
+ <div align="center">
5
+ <b><font size="5">OpenMMLab 官网</font></b>
6
+ <sup>
7
+ <a href="https://openmmlab.com">
8
+ <i><font size="4">HOT</font></i>
9
+ </a>
10
+ </sup>
11
+ &nbsp;&nbsp;&nbsp;&nbsp;
12
+ <b><font size="5">OpenMMLab 开放平台</font></b>
13
+ <sup>
14
+ <a href="https://platform.openmmlab.com">
15
+ <i><font size="4">TRY IT OUT</font></i>
16
+ </a>
17
+ </sup>
18
+ </div>
19
+ <div>&nbsp;</div>
20
+
21
+ [![build](https://github.com/open-mmlab/mmocr/workflows/build/badge.svg)](https://github.com/open-mmlab/mmocr/actions)
22
+ [![docs](https://readthedocs.org/projects/mmocr/badge/?version=dev-1.x)](https://mmocr.readthedocs.io/en/dev-1.x/?badge=dev-1.x)
23
+ [![codecov](https://codecov.io/gh/open-mmlab/mmocr/branch/main/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmocr)
24
+ [![license](https://img.shields.io/github/license/open-mmlab/mmocr.svg)](https://github.com/open-mmlab/mmocr/blob/main/LICENSE)
25
+ [![PyPI](https://badge.fury.io/py/mmocr.svg)](https://pypi.org/project/mmocr/)
26
+ [![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/open-mmlab/mmocr.svg)](https://github.com/open-mmlab/mmocr/issues)
27
+ [![Percentage of issues still open](https://isitmaintained.com/badge/open/open-mmlab/mmocr.svg)](https://github.com/open-mmlab/mmocr/issues)
28
+ <a href="https://console.tiyaro.ai/explore?q=mmocr&pub=mmocr"> <img src="https://tiyaro-public-docs.s3.us-west-2.amazonaws.com/assets/try_on_tiyaro_badge.svg"></a>
29
+
30
+ [📘文档](https://mmocr.readthedocs.io/zh_CN/dev-1.x/) |
31
+ [🛠️安装](https://mmocr.readthedocs.io/zh_CN/dev-1.x/get_started/install.html) |
32
+ [👀模型库](https://mmocr.readthedocs.io/zh_CN/dev-1.x/modelzoo.html) |
33
+ [🆕更新日志](https://mmocr.readthedocs.io/en/dev-1.x/notes/changelog.html) |
34
+ [🤔报告问题](https://github.com/open-mmlab/mmocr/issues/new/choose)
35
+
36
+ </div>
37
+
38
+ <div align="center">
39
+
40
+ [English](/README.md) | 简体中文
41
+
42
+ </div>
43
+
44
+ <div align="center">
45
+ <a href="https://openmmlab.medium.com/" style="text-decoration:none;">
46
+ <img src="https://user-images.githubusercontent.com/25839884/219255827-67c1a27f-f8c5-46a9-811d-5e57448c61d1.png" width="3%" alt="" /></a>
47
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
48
+ <a href="https://discord.gg/raweFPmdzG" style="text-decoration:none;">
49
+ <img src="https://user-images.githubusercontent.com/25839884/218347213-c080267f-cbb6-443e-8532-8e1ed9a58ea9.png" width="3%" alt="" /></a>
50
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
51
+ <a href="https://twitter.com/OpenMMLab" style="text-decoration:none;">
52
+ <img src="https://user-images.githubusercontent.com/25839884/218346637-d30c8a0f-3eba-4699-8131-512fb06d46db.png" width="3%" alt="" /></a>
53
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
54
+ <a href="https://www.youtube.com/openmmlab" style="text-decoration:none;">
55
+ <img src="https://user-images.githubusercontent.com/25839884/218346691-ceb2116a-465a-40af-8424-9f30d2348ca9.png" width="3%" alt="" /></a>
56
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
57
+ <a href="https://space.bilibili.com/1293512903" style="text-decoration:none;">
58
+ <img src="https://user-images.githubusercontent.com/25839884/219026751-d7d14cce-a7c9-4e82-9942-8375fca65b99.png" width="3%" alt="" /></a>
59
+ <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
60
+ <a href="https://www.zhihu.com/people/openmmlab" style="text-decoration:none;">
61
+ <img src="https://user-images.githubusercontent.com/25839884/219026120-ba71e48b-6e94-4bd4-b4e9-b7d175b5e362.png" width="3%" alt="" /></a>
62
+ </div>
63
+
64
+ ## 近期更新
65
+
66
+ **默认分支目前为 `main`,且分支上的代码已经切换到 v1.0.0 版本。旧版 `main` 分支(v0.6.3)的代码现存在 `0.x` 分支上。** 如果您一直在使用 `main` 分支,并遇到升级问题,请阅读 [迁移指南](https://mmocr.readthedocs.io/zh_CN/dev-1.x/migration/overview.html) 和 [分支说明](https://mmocr.readthedocs.io/zh_CN/dev-1.x/migration/branches.html) 。
67
+
68
+ 最新的版本 v1.0.0 于 2023-04-06 发布。其相对于 1.0.0rc6 的主要更新如下:
69
+
70
+ 1. Dataset Preparer 中支持了 SCUT-CTW1500, SynthText 和 MJSynth 数据集;
71
+ 2. 更新了文档和 FAQ;
72
+ 3. 升级文件后端;使用了 `backend_args` 替换 `file_client_args`;
73
+ 4. 增加了 MMOCR 教程 notebook。
74
+
75
+ 如果需要了解 MMOCR 1.0 相对于 0.x 的升级内容,请阅读 [MMOCR 1.x 更新汇总](https://mmocr.readthedocs.io/zh_CN/dev-1.x/migration/news.html);或者阅读[更新日志](https://mmocr.readthedocs.io/zh_CN/dev-1.x/notes/changelog.html)以获取更多信息。
76
+
77
+ ## 简介
78
+
79
+ MMOCR 是基于 PyTorch 和 mmdetection 的开源工具箱,专注于文本检测,文本识别以及相应的下游任务,如关键信息提取。 它是 OpenMMLab 项目的一部分。
80
+
81
+ 主分支目前支持 **PyTorch 1.6 以上**的版本。
82
+
83
+ <div align="center">
84
+ <img src="https://user-images.githubusercontent.com/24622904/187838618-1fdc61c0-2d46-49f9-8502-976ffdf01f28.png"/>
85
+ </div>
86
+
87
+ ### 主要特性
88
+
89
+ -**全流程**
90
+
91
+ 该工具箱不仅支持文本检测和文本识别,还支持其下游任务,例如关键信息提取。
92
+
93
+ -**多种模型**
94
+
95
+ 该工具箱支持用于文本检测,文本识别和关键信息提取的各种最新模型。
96
+
97
+ -**模块化设计**
98
+
99
+ MMOCR 的模块化设计使用户可以定义自己的优化器,数据预处理器,模型组件如主干模块,颈部模块和头部模块,以及损失函数。有关如何构建自定义模型的信息,请参考[概览](https://mmocr.readthedocs.io/zh_CN/dev-1.x/get_started/overview.html)。
100
+
101
+ -**众多实用工具**
102
+
103
+ 该工具箱提供了一套全面的实用程序,可以帮助用户评估模型的性能。它包括可对图像,标注的真值以及预测结果进行可视化的可视化工具,以及用于在训练过程中评估模型的验证工具。它还包括数据转换器,演示了如何将用户自建的标注数据转换为 MMOCR 支持的标注文件。
104
+
105
+ ## 安装
106
+
107
+ MMOCR 依赖 [PyTorch](https://pytorch.org/), [MMEngine](https://github.com/open-mmlab/mmengine), [MMCV](https://github.com/open-mmlab/mmcv) 和 [MMDetection](https://github.com/open-mmlab/mmdetection),以下是安装的简要步骤。
108
+ 更详细的安装指南请参考 [安装文档](https://mmocr.readthedocs.io/zh_CN/dev-1.x/get_started/install.html)。
109
+
110
+ ```shell
111
+ conda create -n open-mmlab python=3.8 pytorch=1.10 cudatoolkit=11.3 torchvision -c pytorch -y
112
+ conda activate open-mmlab
113
+ pip3 install openmim
114
+ git clone https://github.com/open-mmlab/mmocr.git
115
+ cd mmocr
116
+ mim install -e .
117
+ ```
118
+
119
+ ## 快速入门
120
+
121
+ 请参考[快速入门](https://mmocr.readthedocs.io/zh_CN/dev-1.x/get_started/quick_run.html)文档学习 MMOCR 的基本使用。
122
+
123
+ ## [模型库](https://mmocr.readthedocs.io/zh_CN/dev-1.x/modelzoo.html)
124
+
125
+ 支持的算法:
126
+
127
+ <details open>
128
+ <summary>骨干网络</summary>
129
+
130
+ - [x] [oCLIP](configs/backbone/oclip/README.md) (ECCV'2022)
131
+
132
+ </details>
133
+
134
+ <details open>
135
+ <summary>文字检测</summary>
136
+
137
+ - [x] [DBNet](configs/textdet/dbnet/README.md) (AAAI'2020) / [DBNet++](configs/textdet/dbnetpp/README.md) (TPAMI'2022)
138
+ - [x] [Mask R-CNN](configs/textdet/maskrcnn/README.md) (ICCV'2017)
139
+ - [x] [PANet](configs/textdet/panet/README.md) (ICCV'2019)
140
+ - [x] [PSENet](configs/textdet/psenet/README.md) (CVPR'2019)
141
+ - [x] [TextSnake](configs/textdet/textsnake/README.md) (ECCV'2018)
142
+ - [x] [DRRG](configs/textdet/drrg/README.md) (CVPR'2020)
143
+ - [x] [FCENet](configs/textdet/fcenet/README.md) (CVPR'2021)
144
+
145
+ </details>
146
+
147
+ <details open>
148
+ <summary>文字识别</summary>
149
+
150
+ - [x] [ABINet](configs/textrecog/abinet/README.md) (CVPR'2021)
151
+ - [x] [ASTER](configs/textrecog/aster/README.md) (TPAMI'2018)
152
+ - [x] [CRNN](configs/textrecog/crnn/README.md) (TPAMI'2016)
153
+ - [x] [MASTER](configs/textrecog/master/README.md) (PR'2021)
154
+ - [x] [NRTR](configs/textrecog/nrtr/README.md) (ICDAR'2019)
155
+ - [x] [RobustScanner](configs/textrecog/robust_scanner/README.md) (ECCV'2020)
156
+ - [x] [SAR](configs/textrecog/sar/README.md) (AAAI'2019)
157
+ - [x] [SATRN](configs/textrecog/satrn/README.md) (CVPR'2020 Workshop on Text and Documents in the Deep Learning Era)
158
+ - [x] [SVTR](configs/textrecog/svtr/README.md) (IJCAI'2022)
159
+
160
+ </details>
161
+
162
+ <details open>
163
+ <summary>关键信息提取</summary>
164
+
165
+ - [x] [SDMG-R](configs/kie/sdmgr/README.md) (ArXiv'2021)
166
+
167
+ </details>
168
+
169
+ <details open>
170
+ <summary>端对端 OCR</summary>
171
+
172
+ - [x] [ABCNet](projects/ABCNet/README.md) (CVPR'2020)
173
+ - [x] [ABCNetV2](projects/ABCNet/README_V2.md) (TPAMI'2021)
174
+ - [x] [SPTS](projects/SPTS/README.md) (ACM MM'2022)
175
+
176
+ </details>
177
+
178
+ 请点击[模型库](https://mmocr.readthedocs.io/zh_CN/dev-1.x/modelzoo.html)查看更多关于上述算法的详细信息。
179
+
180
+ ## 社区项目
181
+
182
+ [这里](projects/README.md)有一些由社区用户支持和维护的基于 MMOCR 的 SOTA 模型和解决方案的实现。这些项目展示了基于 MMOCR 的研究和产品开发的最佳实践。
183
+ 我们欢迎并感谢对 OpenMMLab 生态系统的所有贡献。
184
+
185
+ ## 贡献指南
186
+
187
+ 我们感谢所有的贡献者为改进和提升 MMOCR 所作出的努力。请参考[贡献指南](.github/CONTRIBUTING.md)来了解参与项目贡献的相关指引。
188
+
189
+ ## 致谢
190
+
191
+ MMOCR 是一款由来自不同高校和企业的研发人员共同参与贡献的开源项目。我们感谢所有为项目提供算法复现和新功能支持的贡献者,以及提供宝贵反馈的用户。 我们希望此工具箱可以帮助大家来复现已有的方法和开发新的方法,从而为研究社区贡献力量。
192
+
193
+ ## 引用
194
+
195
+ 如果您发现此项目对您的研究有用,请考虑引用:
196
+
197
+ ```bibtex
198
+ @article{mmocr2021,
199
+ title={MMOCR: A Comprehensive Toolbox for Text Detection, Recognition and Understanding},
200
+ author={Kuang, Zhanghui and Sun, Hongbin and Li, Zhizhong and Yue, Xiaoyu and Lin, Tsui Hin and Chen, Jianyong and Wei, Huaqiang and Zhu, Yiqin and Gao, Tong and Zhang, Wenwei and Chen, Kai and Zhang, Wayne and Lin, Dahua},
201
+ journal= {arXiv preprint arXiv:2108.06543},
202
+ year={2021}
203
+ }
204
+ ```
205
+
206
+ ## 开源许可证
207
+
208
+ 该项目采用 [Apache 2.0 license](LICENSE) 开源许可证。
209
+
210
+ ## OpenMMLab 的其他项目
211
+
212
+ - [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab 深度学习模型训练基础库
213
+ - [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab 计算机视觉基础库
214
+ - [MIM](https://github.com/open-mmlab/mim): MIM 是 OpenMMlab 项目、算法、模型的统一入口
215
+ - [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab 图像分类工具箱
216
+ - [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab 目标检测工具箱
217
+ - [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab 新一代通用 3D 目标检测平台
218
+ - [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab 旋转框检测工具箱与测试基准
219
+ - [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab 语义分割工具箱
220
+ - [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab 全流程文字检测识别理解工具箱
221
+ - [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab 姿态估计工具箱
222
+ - [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 人体参数化模型工具箱与测试基准
223
+ - [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab 自监督学习工具箱与测试基准
224
+ - [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab 模型压缩工具箱与测试基准
225
+ - [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab 少样本学习工具箱与测试基准
226
+ - [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab 新一代视频理解工具箱
227
+ - [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab 一体化视频目标感知平台
228
+ - [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab 光流估计工具箱与测试基准
229
+ - [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab 图像视频编辑工具箱
230
+ - [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab 图片视频生成模型工具箱
231
+ - [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab 模型部署框架
232
+
233
+ ## 欢迎加入 OpenMMLab 社区
234
+
235
+ 扫描下方的二维码可关注 OpenMMLab 团队的 [知乎官方账号](https://www.zhihu.com/people/openmmlab),加入 OpenMMLab 团队的 [官方交流 QQ 群](https://r.vansin.top/?r=join-qq),或通过添加微信“Open小喵Lab”加入官方交流微信群。
236
+
237
+ <div align="center">
238
+ <img src="https://raw.githubusercontent.com/open-mmlab/mmcv/master/docs/en/_static/zhihu_qrcode.jpg" height="400" /> <img src="https://cdn.vansin.top/OpenMMLab/q3.png" height="400" /> <img src="https://raw.githubusercontent.com/open-mmlab/mmcv/master/docs/en/_static/wechat_qrcode.jpg" height="400" />
239
+ </div>
240
+
241
+ 我们会在 OpenMMLab 社区为大家
242
+
243
+ - 📢 分享 AI 框架的前沿核心技术
244
+ - 💻 解读 PyTorch 常用模块源码
245
+ - 📰 发布 OpenMMLab 的相关新闻
246
+ - 🚀 介绍 OpenMMLab 开发的前沿算法
247
+ - 🏃 获取更高效的问题答疑和意见反馈
248
+ - 🔥 提供与各行各业开发者充分交流的平台
249
+
250
+ 干货满满 📘,等你来撩 💗,OpenMMLab 社区期待您的加入 👬
mmocr-dev-1.x/configs/backbone/oclip/README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # oCLIP
2
+
3
+ > [Language Matters: A Weakly Supervised Vision-Language Pre-training Approach for Scene Text Detection and Spotting](https://www.ecva.net/papers/eccv_2022/papers_ECCV/papers/136880282.pdf)
4
+
5
+ <!-- [ALGORITHM] -->
6
+
7
+ ## Abstract
8
+
9
+ Recently, Vision-Language Pre-training (VLP) techniques have greatly benefited various vision-language tasks by jointly learning visual and textual representations, which intuitively helps in Optical Character Recognition (OCR) tasks due to the rich visual and textual information in scene text images. However, these methods cannot well cope with OCR tasks because of the difficulty in both instance-level text encoding and image-text pair acquisition (i.e. images and captured texts in them). This paper presents a weakly supervised pre-training method, oCLIP, which can acquire effective scene text representations by jointly learning and aligning visual and textual information. Our network consists of an image encoder and a character-aware text encoder that extract visual and textual features, respectively, as well as a visual-textual decoder that models the interaction among textual and visual features for learning effective scene text representations. With the learning of textual features, the pre-trained model can attend texts in images well with character awareness. Besides, these designs enable the learning from weakly annotated texts (i.e. partial texts in images without text bounding boxes) which mitigates the data annotation constraint greatly. Experiments over the weakly annotated images in ICDAR2019-LSVT show that our pre-trained model improves F-score by +2.5% and +4.8% while transferring its weights to other text detection and spotting networks, respectively. In addition, the proposed method outperforms existing pre-training techniques consistently across multiple public datasets (e.g., +3.2% and +1.3% for Total-Text and CTW1500).
10
+
11
+ <div align=center>
12
+ <img src="https://user-images.githubusercontent.com/24622904/199475057-aa688422-518d-4d7a-86fc-1be0cc1b5dc6.png"/>
13
+ </div>
14
+
15
+ ## Models
16
+
17
+ | Backbone | Pre-train Data | Model |
18
+ | :-------: | :------------: | :-------------------------------------------------------------------------------: |
19
+ | ResNet-50 | SynthText | [Link](https://download.openmmlab.com/mmocr/backbone/resnet50-oclip-7ba0c533.pth) |
20
+
21
+ ```{note}
22
+ The model is converted from the official [oCLIP](https://github.com/bytedance/oclip.git).
23
+ ```
24
+
25
+ ## Supported Text Detection Models
26
+
27
+ | | [DBNet](https://mmocr.readthedocs.io/en/dev-1.x/textdet_models.html#dbnet) | [DBNet++](https://mmocr.readthedocs.io/en/dev-1.x/textdet_models.html#dbnetpp) | [FCENet](https://mmocr.readthedocs.io/en/dev-1.x/textdet_models.html#fcenet) | [TextSnake](https://mmocr.readthedocs.io/en/dev-1.x/textdet_models.html#fcenet) | [PSENet](https://mmocr.readthedocs.io/en/dev-1.x/textdet_models.html#psenet) | [DRRG](https://mmocr.readthedocs.io/en/dev-1.x/textdet_models.html#drrg) | [Mask R-CNN](https://mmocr.readthedocs.io/en/dev-1.x/textdet_models.html#mask-r-cnn) |
28
+ | :-------: | :------------------------------------------------------------------------: | :----------------------------------------------------------------------------: | :--------------------------------------------------------------------------: | :-----------------------------------------------------------------------------: | :--------------------------------------------------------------------------: | :----------------------------------------------------------------------: | :----------------------------------------------------------------------------------: |
29
+ | ICDAR2015 | ✓ | ✓ | ✓ | | ✓ | | ✓ |
30
+ | CTW1500 | | | ✓ | ✓ | ✓ | ✓ | ✓ |
31
+
32
+ ## Citation
33
+
34
+ ```bibtex
35
+ @article{xue2022language,
36
+ title={Language Matters: A Weakly Supervised Vision-Language Pre-training Approach for Scene Text Detection and Spotting},
37
+ author={Xue, Chuhui and Zhang, Wenqing and Hao, Yu and Lu, Shijian and Torr, Philip and Bai, Song},
38
+ journal={Proceedings of the European Conference on Computer Vision (ECCV)},
39
+ year={2022}
40
+ }
41
+ ```
mmocr-dev-1.x/configs/backbone/oclip/metafile.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Collections:
2
+ - Name: oCLIP
3
+ Metadata:
4
+ Training Data: SynthText
5
+ Architecture:
6
+ - CLIPResNet
7
+ Paper:
8
+ URL: https://arxiv.org/abs/2203.03911
9
+ Title: 'Language Matters: A Weakly Supervised Vision-Language Pre-training Approach for Scene Text Detection and Spotting'
10
+ README: configs/backbone/oclip/README.md
11
+
12
+ Models:
13
+ Weights: https://download.openmmlab.com/mmocr/backbone/resnet50-oclip-7ba0c533.pth
mmocr-dev-1.x/configs/kie/_base_/datasets/wildreceipt-openset.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ wildreceipt_openset_data_root = 'data/wildreceipt/'
2
+
3
+ wildreceipt_openset_train = dict(
4
+ type='WildReceiptDataset',
5
+ data_root=wildreceipt_openset_data_root,
6
+ metainfo=dict(category=[
7
+ dict(id=0, name='bg'),
8
+ dict(id=1, name='key'),
9
+ dict(id=2, name='value'),
10
+ dict(id=3, name='other')
11
+ ]),
12
+ ann_file='openset_train.txt',
13
+ pipeline=None)
14
+
15
+ wildreceipt_openset_test = dict(
16
+ type='WildReceiptDataset',
17
+ data_root=wildreceipt_openset_data_root,
18
+ metainfo=dict(category=[
19
+ dict(id=0, name='bg'),
20
+ dict(id=1, name='key'),
21
+ dict(id=2, name='value'),
22
+ dict(id=3, name='other')
23
+ ]),
24
+ ann_file='openset_test.txt',
25
+ test_mode=True,
26
+ pipeline=None)
mmocr-dev-1.x/configs/kie/_base_/datasets/wildreceipt.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ wildreceipt_data_root = 'data/wildreceipt/'
2
+
3
+ wildreceipt_train = dict(
4
+ type='WildReceiptDataset',
5
+ data_root=wildreceipt_data_root,
6
+ metainfo=wildreceipt_data_root + 'class_list.txt',
7
+ ann_file='train.txt',
8
+ pipeline=None)
9
+
10
+ wildreceipt_test = dict(
11
+ type='WildReceiptDataset',
12
+ data_root=wildreceipt_data_root,
13
+ metainfo=wildreceipt_data_root + 'class_list.txt',
14
+ ann_file='test.txt',
15
+ test_mode=True,
16
+ pipeline=None)
mmocr-dev-1.x/configs/kie/_base_/default_runtime.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ default_scope = 'mmocr'
2
+ env_cfg = dict(
3
+ cudnn_benchmark=False,
4
+ mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0),
5
+ dist_cfg=dict(backend='nccl'),
6
+ )
7
+ randomness = dict(seed=None)
8
+
9
+ default_hooks = dict(
10
+ timer=dict(type='IterTimerHook'),
11
+ logger=dict(type='LoggerHook', interval=100),
12
+ param_scheduler=dict(type='ParamSchedulerHook'),
13
+ checkpoint=dict(type='CheckpointHook', interval=1),
14
+ sampler_seed=dict(type='DistSamplerSeedHook'),
15
+ sync_buffer=dict(type='SyncBuffersHook'),
16
+ visualization=dict(
17
+ type='VisualizationHook',
18
+ interval=1,
19
+ enable=False,
20
+ show=False,
21
+ draw_gt=False,
22
+ draw_pred=False),
23
+ )
24
+
25
+ # Logging
26
+ log_level = 'INFO'
27
+ log_processor = dict(type='LogProcessor', window_size=10, by_epoch=True)
28
+
29
+ load_from = None
30
+ resume = False
31
+
32
+ visualizer = dict(
33
+ type='KIELocalVisualizer', name='visualizer', is_openset=False)
mmocr-dev-1.x/configs/kie/_base_/schedules/schedule_adam_60e.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # optimizer
2
+ optim_wrapper = dict(
3
+ type='OptimWrapper', optimizer=dict(type='Adam', weight_decay=0.0001))
4
+ train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=60, val_interval=1)
5
+ val_cfg = dict(type='ValLoop')
6
+ test_cfg = dict(type='TestLoop')
7
+ # learning rate
8
+ param_scheduler = [
9
+ dict(type='MultiStepLR', milestones=[40, 50], end=60),
10
+ ]
mmocr-dev-1.x/configs/kie/sdmgr/README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SDMGR
2
+
3
+ > [Spatial Dual-Modality Graph Reasoning for Key Information Extraction](https://arxiv.org/abs/2103.14470)
4
+
5
+ <!-- [ALGORITHM] -->
6
+
7
+ ## Abstract
8
+
9
+ Key information extraction from document images is of paramount importance in office automation. Conventional template matching based approaches fail to generalize well to document images of unseen templates, and are not robust against text recognition errors. In this paper, we propose an end-to-end Spatial Dual-Modality Graph Reasoning method (SDMG-R) to extract key information from unstructured document images. We model document images as dual-modality graphs, nodes of which encode both the visual and textual features of detected text regions, and edges of which represent the spatial relations between neighboring text regions. The key information extraction is solved by iteratively propagating messages along graph edges and reasoning the categories of graph nodes. In order to roundly evaluate our proposed method as well as boost the future research, we release a new dataset named WildReceipt, which is collected and annotated tailored for the evaluation of key information extraction from document images of unseen templates in the wild. It contains 25 key information categories, a total of about 69000 text boxes, and is about 2 times larger than the existing public datasets. Extensive experiments validate that all information including visual features, textual features and spatial relations can benefit key information extraction. It has been shown that SDMG-R can effectively extract key information from document images of unseen templates, and obtain new state-of-the-art results on the recent popular benchmark SROIE and our WildReceipt. Our code and dataset will be publicly released.
10
+
11
+ <div align=center>
12
+ <img src="https://user-images.githubusercontent.com/22607038/142580689-18edb4d7-f716-475c-b1c1-e2b934658cee.png"/>
13
+ </div>
14
+
15
+ ## Results and models
16
+
17
+ ### WildReceipt
18
+
19
+ | Method | Modality | Macro F1-Score | Download |
20
+ | :--------------------------------------------------------------------: | :--------------: | :------------: | :--------------------------------------------------------------------------------------------------: |
21
+ | [sdmgr_unet16](/configs/kie/sdmgr/sdmgr_unet16_60e_wildreceipt.py) | Visual + Textual | 0.890 | [model](https://download.openmmlab.com/mmocr/kie/sdmgr/sdmgr_unet16_60e_wildreceipt/sdmgr_unet16_60e_wildreceipt_20220825_151648-22419f37.pth) \| [log](https://download.openmmlab.com/mmocr/kie/sdmgr/sdmgr_unet16_60e_wildreceipt/20220825_151648.log) |
22
+ | [sdmgr_novisual](/configs/kie/sdmgr/sdmgr_novisual_60e_wildreceipt.py) | Textual | 0.873 | [model](https://download.openmmlab.com/mmocr/kie/sdmgr/sdmgr_novisual_60e_wildreceipt/sdmgr_novisual_60e_wildreceipt_20220831_193317-827649d8.pth) \| [log](https://download.openmmlab.com/mmocr/kie/sdmgr/sdmgr_novisual_60e_wildreceipt/20220831_193317.log) |
23
+
24
+ ### WildReceiptOpenset
25
+
26
+ | Method | Modality | Edge F1-Score | Node Macro F1-Score | Node Micro F1-Score | Download |
27
+ | :-------------------------------------------------------------------: | :------: | :-----------: | :-----------------: | :-----------------: | :----------------------------------------------------------------------: |
28
+ | [sdmgr_novisual_openset](/configs/kie/sdmgr/sdmgr_novisual_60e_wildreceipt-openset.py) | Textual | 0.792 | 0.931 | 0.940 | [model](https://download.openmmlab.com/mmocr/kie/sdmgr/sdmgr_novisual_60e_wildreceipt-openset/sdmgr_novisual_60e_wildreceipt-openset_20220831_200807-dedf15ec.pth) \| [log](https://download.openmmlab.com/mmocr/kie/sdmgr/sdmgr_novisual_60e_wildreceipt-openset/20220831_200807.log) |
29
+
30
+ ## Citation
31
+
32
+ ```bibtex
33
+ @misc{sun2021spatial,
34
+ title={Spatial Dual-Modality Graph Reasoning for Key Information Extraction},
35
+ author={Hongbin Sun and Zhanghui Kuang and Xiaoyu Yue and Chenhao Lin and Wayne Zhang},
36
+ year={2021},
37
+ eprint={2103.14470},
38
+ archivePrefix={arXiv},
39
+ primaryClass={cs.CV}
40
+ }
41
+ ```
mmocr-dev-1.x/configs/kie/sdmgr/_base_sdmgr_novisual.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ num_classes = 26
2
+
3
+ model = dict(
4
+ type='SDMGR',
5
+ kie_head=dict(
6
+ type='SDMGRHead',
7
+ visual_dim=16,
8
+ num_classes=num_classes,
9
+ module_loss=dict(type='SDMGRModuleLoss'),
10
+ postprocessor=dict(type='SDMGRPostProcessor')),
11
+ dictionary=dict(
12
+ type='Dictionary',
13
+ dict_file='{{ fileDirname }}/../../../dicts/sdmgr_dict.txt',
14
+ with_padding=True,
15
+ with_unknown=True,
16
+ unknown_token=None),
17
+ )
18
+
19
+ train_pipeline = [
20
+ dict(type='LoadKIEAnnotations'),
21
+ dict(type='Resize', scale=(1024, 512), keep_ratio=True),
22
+ dict(type='PackKIEInputs')
23
+ ]
24
+ test_pipeline = [
25
+ dict(type='LoadKIEAnnotations'),
26
+ dict(type='Resize', scale=(1024, 512), keep_ratio=True),
27
+ dict(type='PackKIEInputs'),
28
+ ]
29
+
30
+ val_evaluator = dict(
31
+ type='F1Metric',
32
+ mode='macro',
33
+ num_classes=num_classes,
34
+ ignored_classes=[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 25])
35
+ test_evaluator = val_evaluator
mmocr-dev-1.x/configs/kie/sdmgr/_base_sdmgr_unet16.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _base_ = '_base_sdmgr_novisual.py'
2
+
3
+ model = dict(
4
+ backbone=dict(type='UNet', base_channels=16),
5
+ roi_extractor=dict(
6
+ type='mmdet.SingleRoIExtractor',
7
+ roi_layer=dict(type='RoIAlign', output_size=7),
8
+ featmap_strides=[1]),
9
+ data_preprocessor=dict(
10
+ type='ImgDataPreprocessor',
11
+ mean=[123.675, 116.28, 103.53],
12
+ std=[58.395, 57.12, 57.375],
13
+ bgr_to_rgb=True,
14
+ pad_size_divisor=32),
15
+ )
16
+
17
+ train_pipeline = [
18
+ dict(type='LoadImageFromFile'),
19
+ dict(type='LoadKIEAnnotations'),
20
+ dict(type='Resize', scale=(1024, 512), keep_ratio=True),
21
+ dict(type='PackKIEInputs')
22
+ ]
23
+ test_pipeline = [
24
+ dict(type='LoadImageFromFile'),
25
+ dict(type='LoadKIEAnnotations'),
26
+ dict(type='Resize', scale=(1024, 512), keep_ratio=True),
27
+ dict(type='PackKIEInputs', meta_keys=('img_path', )),
28
+ ]
mmocr-dev-1.x/configs/kie/sdmgr/metafile.yml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Collections:
2
+ - Name: SDMGR
3
+ Metadata:
4
+ Training Data: KIEDataset
5
+ Training Techniques:
6
+ - Adam
7
+ Training Resources: 1x NVIDIA A100-SXM4-80GB
8
+ Architecture:
9
+ - UNet
10
+ - SDMGRHead
11
+ Paper:
12
+ URL: https://arxiv.org/abs/2103.14470.pdf
13
+ Title: 'Spatial Dual-Modality Graph Reasoning for Key Information Extraction'
14
+ README: configs/kie/sdmgr/README.md
15
+
16
+ Models:
17
+ - Name: sdmgr_unet16_60e_wildreceipt
18
+ Alias: SDMGR
19
+ In Collection: SDMGR
20
+ Config: configs/kie/sdmgr/sdmgr_unet16_60e_wildreceipt.py
21
+ Metadata:
22
+ Training Data: wildreceipt
23
+ Results:
24
+ - Task: Key Information Extraction
25
+ Dataset: wildreceipt
26
+ Metrics:
27
+ macro_f1: 0.890
28
+ Weights: https://download.openmmlab.com/mmocr/kie/sdmgr/sdmgr_unet16_60e_wildreceipt/sdmgr_unet16_60e_wildreceipt_20220825_151648-22419f37.pth
29
+ - Name: sdmgr_novisual_60e_wildreceipt
30
+ In Collection: SDMGR
31
+ Config: configs/kie/sdmgr/sdmgr_novisual_60e_wildreceipt.py
32
+ Metadata:
33
+ Training Data: wildreceipt
34
+ Results:
35
+ - Task: Key Information Extraction
36
+ Dataset: wildreceipt
37
+ Metrics:
38
+ macro_f1: 0.873
39
+ Weights: https://download.openmmlab.com/mmocr/kie/sdmgr/sdmgr_novisual_60e_wildreceipt/sdmgr_novisual_60e_wildreceipt_20220831_193317-827649d8.pth
40
+ - Name: sdmgr_novisual_60e_wildreceipt_openset
41
+ In Collection: SDMGR
42
+ Config: configs/kie/sdmgr/sdmgr_novisual_60e_wildreceipt-openset.py
43
+ Metadata:
44
+ Training Data: wildreceipt-openset
45
+ Results:
46
+ - Task: Key Information Extraction
47
+ Dataset: wildreceipt
48
+ Metrics:
49
+ macro_f1: 0.931
50
+ micro_f1: 0.940
51
+ edge_micro_f1: 0.792
52
+ Weights: https://download.openmmlab.com/mmocr/kie/sdmgr/sdmgr_novisual_60e_wildreceipt-openset/sdmgr_novisual_60e_wildreceipt-openset_20220831_200807-dedf15ec.pth
mmocr-dev-1.x/configs/kie/sdmgr/sdmgr_novisual_60e_wildreceipt-openset.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _base_ = [
2
+ '../_base_/default_runtime.py',
3
+ '../_base_/datasets/wildreceipt-openset.py',
4
+ '../_base_/schedules/schedule_adam_60e.py',
5
+ '_base_sdmgr_novisual.py',
6
+ ]
7
+
8
+ node_num_classes = 4 # 4 classes: bg, key, value and other
9
+ edge_num_classes = 2 # edge connectivity
10
+ key_node_idx = 1
11
+ value_node_idx = 2
12
+
13
+ model = dict(
14
+ type='SDMGR',
15
+ kie_head=dict(
16
+ num_classes=node_num_classes,
17
+ postprocessor=dict(
18
+ link_type='one-to-many',
19
+ key_node_idx=key_node_idx,
20
+ value_node_idx=value_node_idx)),
21
+ )
22
+
23
+ test_pipeline = [
24
+ dict(
25
+ type='LoadKIEAnnotations',
26
+ key_node_idx=key_node_idx,
27
+ value_node_idx=value_node_idx), # Keep key->value edges for evaluation
28
+ dict(type='Resize', scale=(1024, 512), keep_ratio=True),
29
+ dict(type='PackKIEInputs'),
30
+ ]
31
+
32
+ wildreceipt_openset_train = _base_.wildreceipt_openset_train
33
+ wildreceipt_openset_train.pipeline = _base_.train_pipeline
34
+ wildreceipt_openset_test = _base_.wildreceipt_openset_test
35
+ wildreceipt_openset_test.pipeline = test_pipeline
36
+
37
+ train_dataloader = dict(
38
+ batch_size=4,
39
+ num_workers=1,
40
+ persistent_workers=True,
41
+ sampler=dict(type='DefaultSampler', shuffle=True),
42
+ dataset=wildreceipt_openset_train)
43
+ val_dataloader = dict(
44
+ batch_size=1,
45
+ num_workers=1,
46
+ persistent_workers=True,
47
+ sampler=dict(type='DefaultSampler', shuffle=False),
48
+ dataset=wildreceipt_openset_test)
49
+ test_dataloader = val_dataloader
50
+
51
+ val_evaluator = [
52
+ dict(
53
+ type='F1Metric',
54
+ prefix='node',
55
+ key='labels',
56
+ mode=['micro', 'macro'],
57
+ num_classes=node_num_classes,
58
+ cared_classes=[key_node_idx, value_node_idx]),
59
+ dict(
60
+ type='F1Metric',
61
+ prefix='edge',
62
+ mode='micro',
63
+ key='edge_labels',
64
+ cared_classes=[1], # Collapse to binary F1 score
65
+ num_classes=edge_num_classes)
66
+ ]
67
+ test_evaluator = val_evaluator
68
+
69
+ visualizer = dict(
70
+ type='KIELocalVisualizer', name='visualizer', is_openset=True)
71
+ auto_scale_lr = dict(base_batch_size=4)
mmocr-dev-1.x/configs/kie/sdmgr/sdmgr_novisual_60e_wildreceipt.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _base_ = [
2
+ '../_base_/default_runtime.py',
3
+ '../_base_/datasets/wildreceipt.py',
4
+ '../_base_/schedules/schedule_adam_60e.py',
5
+ '_base_sdmgr_novisual.py',
6
+ ]
7
+
8
+ wildreceipt_train = _base_.wildreceipt_train
9
+ wildreceipt_train.pipeline = _base_.train_pipeline
10
+ wildreceipt_test = _base_.wildreceipt_test
11
+ wildreceipt_test.pipeline = _base_.test_pipeline
12
+
13
+ train_dataloader = dict(
14
+ batch_size=4,
15
+ num_workers=1,
16
+ persistent_workers=True,
17
+ sampler=dict(type='DefaultSampler', shuffle=True),
18
+ dataset=wildreceipt_train)
19
+
20
+ val_dataloader = dict(
21
+ batch_size=1,
22
+ num_workers=1,
23
+ persistent_workers=True,
24
+ sampler=dict(type='DefaultSampler', shuffle=False),
25
+ dataset=wildreceipt_test)
26
+ test_dataloader = val_dataloader
27
+
28
+ auto_scale_lr = dict(base_batch_size=4)
mmocr-dev-1.x/configs/kie/sdmgr/sdmgr_unet16_60e_wildreceipt.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _base_ = [
2
+ '../_base_/default_runtime.py',
3
+ '../_base_/datasets/wildreceipt.py',
4
+ '../_base_/schedules/schedule_adam_60e.py',
5
+ '_base_sdmgr_unet16.py',
6
+ ]
7
+
8
+ wildreceipt_train = _base_.wildreceipt_train
9
+ wildreceipt_train.pipeline = _base_.train_pipeline
10
+ wildreceipt_test = _base_.wildreceipt_test
11
+ wildreceipt_test.pipeline = _base_.test_pipeline
12
+
13
+ train_dataloader = dict(
14
+ batch_size=4,
15
+ num_workers=4,
16
+ persistent_workers=True,
17
+ sampler=dict(type='DefaultSampler', shuffle=True),
18
+ dataset=wildreceipt_train)
19
+
20
+ val_dataloader = dict(
21
+ batch_size=1,
22
+ num_workers=1,
23
+ persistent_workers=True,
24
+ sampler=dict(type='DefaultSampler', shuffle=False),
25
+ dataset=wildreceipt_test)
26
+
27
+ test_dataloader = val_dataloader
28
+
29
+ auto_scale_lr = dict(base_batch_size=4)
mmocr-dev-1.x/configs/textdet/_base_/datasets/ctw1500.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ctw1500_textdet_data_root = 'data/ctw1500'
2
+
3
+ ctw1500_textdet_train = dict(
4
+ type='OCRDataset',
5
+ data_root=ctw1500_textdet_data_root,
6
+ ann_file='textdet_train.json',
7
+ filter_cfg=dict(filter_empty_gt=True, min_size=32),
8
+ pipeline=None)
9
+
10
+ ctw1500_textdet_test = dict(
11
+ type='OCRDataset',
12
+ data_root=ctw1500_textdet_data_root,
13
+ ann_file='textdet_test.json',
14
+ test_mode=True,
15
+ pipeline=None)
mmocr-dev-1.x/configs/textdet/_base_/datasets/icdar2015.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ icdar2015_textdet_data_root = 'data/icdar2015'
2
+
3
+ icdar2015_textdet_train = dict(
4
+ type='OCRDataset',
5
+ data_root=icdar2015_textdet_data_root,
6
+ ann_file='textdet_train.json',
7
+ filter_cfg=dict(filter_empty_gt=True, min_size=32),
8
+ pipeline=None)
9
+
10
+ icdar2015_textdet_test = dict(
11
+ type='OCRDataset',
12
+ data_root=icdar2015_textdet_data_root,
13
+ ann_file='textdet_test.json',
14
+ test_mode=True,
15
+ pipeline=None)
mmocr-dev-1.x/configs/textdet/_base_/datasets/icdar2017.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ icdar2017_textdet_data_root = 'data/det/icdar_2017'
2
+
3
+ icdar2017_textdet_train = dict(
4
+ type='OCRDataset',
5
+ data_root=icdar2017_textdet_data_root,
6
+ ann_file='instances_training.json',
7
+ data_prefix=dict(img_path='imgs/'),
8
+ filter_cfg=dict(filter_empty_gt=True, min_size=32),
9
+ pipeline=None)
10
+
11
+ icdar2017_textdet_test = dict(
12
+ type='OCRDataset',
13
+ data_root=icdar2017_textdet_data_root,
14
+ ann_file='instances_test.json',
15
+ data_prefix=dict(img_path='imgs/'),
16
+ test_mode=True,
17
+ pipeline=None)