From a58c77df80c02cc5fdb49c507a4a1bc6c654e13a Mon Sep 17 00:00:00 2001 From: Tong Gao Date: Fri, 10 Mar 2023 14:51:57 +0800 Subject: [PATCH] [Docs] FAQ (#1773) --- .github/ISSUE_TEMPLATE/config.yml | 6 ++-- docs/en/get_started/faq.md | 46 +++++++++++++++++++++++++++++++ docs/en/index.rst | 2 +- docs/en/notes/faq.md | 1 - docs/zh_cn/index.rst | 2 +- docs/zh_cn/notes/faq.md | 1 - 6 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 docs/en/get_started/faq.md delete mode 100644 docs/en/notes/faq.md delete mode 100644 docs/zh_cn/notes/faq.md diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index e801b610..fca6615a 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -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 diff --git a/docs/en/get_started/faq.md b/docs/en/get_started/faq.md new file mode 100644 index 00000000..23f45060 --- /dev/null +++ b/docs/en/get_started/faq.md @@ -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). diff --git a/docs/en/index.rst b/docs/en/index.rst index fe74a6ba..bfde5718 100644 --- a/docs/en/index.rst +++ b/docs/en/index.rst @@ -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 diff --git a/docs/en/notes/faq.md b/docs/en/notes/faq.md deleted file mode 100644 index 4514b4c1..00000000 --- a/docs/en/notes/faq.md +++ /dev/null @@ -1 +0,0 @@ -# FAQ diff --git a/docs/zh_cn/index.rst b/docs/zh_cn/index.rst index 51560738..78da7888 100644 --- a/docs/zh_cn/index.rst +++ b/docs/zh_cn/index.rst @@ -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 diff --git a/docs/zh_cn/notes/faq.md b/docs/zh_cn/notes/faq.md deleted file mode 100644 index b43101d1..00000000 --- a/docs/zh_cn/notes/faq.md +++ /dev/null @@ -1 +0,0 @@ -# 常见问题