[Docs] FAQ (#1773)

pull/1781/head
Tong Gao 2023-03-10 14:51:57 +08:00 committed by GitHub
parent e9b23c56ad
commit a58c77df80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 7 deletions

View File

@ -1,12 +1,12 @@
blank_issues_enabled: false
contact_links:
- name: ❔ FAQ
url: https://mmocr.readthedocs.io/en/dev-1.x/get_started/faq.html
about: Is your question frequently asked?
- name: 💬 Forum
url: https://github.com/open-mmlab/mmocr/discussions
about: Ask general usage questions and discuss with other MMOCR community members
- name: MMOCR Documentation
url: https://mmocr.readthedocs.io/en/latest/
about: Check if your question is answered in docs
- name: 🌐 Explore OpenMMLab
url: https://openmmlab.com/
about: Get know more about OpenMMLab

View File

@ -0,0 +1,46 @@
# FAQ
## General
**Q1** I'm getting the warning like `unexpected key in source state_dict: fc.weight, fc.bias`, is there something wrong?
**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.
**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?
**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:
```python
train_pipeline = [
...
dict(
type='LoadOCRAnnotations',
with_polygon=True,
with_bbox=True,
with_label=True,
),
dict(type='FixInvalidPolygon', min_poly_points=4),
...
]
```
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.
## Text Recognition
**Q1** What are the steps to train text recognition models with my own dictionary?
**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:
```python
dictionary = dict(
type='Dictionary',
dict_file='/my/dict.txt',
with_start=True,
with_end=True,
same_start_end=True,
with_padding=True,
with_unknown=True)
```
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).

View File

@ -10,6 +10,7 @@ You can switch between English and Chinese in the lower-left corner of the layou
get_started/overview.md
get_started/install.md
get_started/quick_run.md
get_started/faq.md
.. toctree::
:maxdepth: 2
@ -74,7 +75,6 @@ You can switch between English and Chinese in the lower-left corner of the layou
notes/contribution_guide.md
notes/projects.md
notes/changelog.md
notes/faq.md
.. toctree::
:maxdepth: 1

View File

@ -1 +0,0 @@
# FAQ

View File

@ -10,6 +10,7 @@
get_started/overview.md
get_started/install.md
get_started/quick_run.md
get_started/faq.md
.. toctree::
:maxdepth: 2
@ -74,7 +75,6 @@
notes/contribution_guide.md
notes/projects.md
notes/changelog.md
notes/faq.md
.. toctree::
:maxdepth: 2

View File

@ -1 +0,0 @@
# 常见问题