Skip to content

Commit a58c77d

Browse files
authored
[Docs] FAQ (#1773)
1 parent e9b23c5 commit a58c77d

File tree

6 files changed

+51
-7
lines changed

6 files changed

+51
-7
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
blank_issues_enabled: false
22

33
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?
47
- name: 💬 Forum
58
url: https://github.com/open-mmlab/mmocr/discussions
69
about: Ask general usage questions and discuss with other MMOCR community members
7-
- name: MMOCR Documentation
8-
url: https://mmocr.readthedocs.io/en/latest/
9-
about: Check if your question is answered in docs
1010
- name: 🌐 Explore OpenMMLab
1111
url: https://openmmlab.com/
1212
about: Get know more about OpenMMLab

docs/en/get_started/faq.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# FAQ
2+
3+
## General
4+
5+
**Q1** I'm getting the warning like `unexpected key in source state_dict: fc.weight, fc.bias`, is there something wrong?
6+
7+
**A** It's not an error. It occurs because the backbone network is pretrained on image classification tasks, where the last fc layer is required to generate the classification output. However, the fc layer is no longer needed when the backbone network is used to extract features in downstream tasks, and therefore these weights can be safely skipped when loading the checkpoint.
8+
9+
**Q2** MMOCR terminates with an error: `shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry`. How could I fix it?
10+
11+
**A** This error occurs because of some invalid polygons (e.g., polygons with self-intersections) existing in the dataset or generated by some non-rigorous data transforms. These polygons can be fixed by adding `FixInvalidPolygon` transform after the transform likely to introduce invalid polygons. For example, a common practice is to append it after `LoadOCRAnnotations` in both train and test pipeline. The resulting pipeline should look like:
12+
13+
```python
14+
train_pipeline = [
15+
...
16+
dict(
17+
type='LoadOCRAnnotations',
18+
with_polygon=True,
19+
with_bbox=True,
20+
with_label=True,
21+
),
22+
dict(type='FixInvalidPolygon', min_poly_points=4),
23+
...
24+
]
25+
```
26+
27+
In practice, we find that Totaltext contains some invalid polygons and using `FixInvalidPolygon` is a must. [Here](https://github.com/open-mmlab/mmocr/blob/27b6a68586b9a040678fe083bcf60662ae1b9261/configs/textdet/dbnet/dbnet_resnet18_fpnc_1200e_totaltext.py) is an example config.
28+
29+
## Text Recognition
30+
31+
**Q1** What are the steps to train text recognition models with my own dictionary?
32+
33+
**A** In MMOCR 1.0, you only need to modify the config and point `Dictionary` to your custom dict file. For example, if you want to train SAR model (https://github.com/open-mmlab/mmocr/blob/75c06d34bbc01d3d11dfd7afc098b6cdeee82579/configs/textrecog/sar/sar_resnet31_parallel-decoder_5e_st-sub_mj-sub_sa_real.py) with your own dictionary placed at `/my/dict.txt`, you can modify `dictionary.dict_file` term in [base config](https://github.com/open-mmlab/mmocr/blob/75c06d34bbc01d3d11dfd7afc098b6cdeee82579/configs/textrecog/sar/_base_sar_resnet31_parallel-decoder.py#L1) to:
34+
35+
```python
36+
dictionary = dict(
37+
type='Dictionary',
38+
dict_file='/my/dict.txt',
39+
with_start=True,
40+
with_end=True,
41+
same_start_end=True,
42+
with_padding=True,
43+
with_unknown=True)
44+
```
45+
46+
Now you are good to go. You can also find more information in [Dictionary API](https://mmocr.readthedocs.io/en/dev-1.x/api/generated/mmocr.models.common.Dictionary.html#mmocr.models.common.Dictionary).

docs/en/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ You can switch between English and Chinese in the lower-left corner of the layou
1010
get_started/overview.md
1111
get_started/install.md
1212
get_started/quick_run.md
13+
get_started/faq.md
1314

1415
.. toctree::
1516
:maxdepth: 2
@@ -74,7 +75,6 @@ You can switch between English and Chinese in the lower-left corner of the layou
7475
notes/contribution_guide.md
7576
notes/projects.md
7677
notes/changelog.md
77-
notes/faq.md
7878

7979
.. toctree::
8080
:maxdepth: 1

docs/en/notes/faq.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/zh_cn/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
get_started/overview.md
1111
get_started/install.md
1212
get_started/quick_run.md
13+
get_started/faq.md
1314

1415
.. toctree::
1516
:maxdepth: 2
@@ -74,7 +75,6 @@
7475
notes/contribution_guide.md
7576
notes/projects.md
7677
notes/changelog.md
77-
notes/faq.md
7878

7979
.. toctree::
8080
:maxdepth: 2

docs/zh_cn/notes/faq.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)