Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Refactor Inferencers #1608

Merged
merged 26 commits into from
Feb 2, 2023
Merged

Conversation

gaotongxiao
Copy link
Collaborator

@gaotongxiao gaotongxiao commented Dec 7, 2022

Refactor inferencers and their entry script based on mmengine.BaseInferencer

For colleagues: BaseMMOCRInferencer, TextDetInferencer and TextRecInferencer are good reference points.

Attention

To users who have been using 1.x/dev-1.x branch on Windows and wish to upgrade MMOCR to use new Inferencers: You may encounter the following error:

FileNotFoundError: class `CRNN` in mmocr/models/textrecog/recognizers/crnn.py: class `CRNNDecoder` in mmocr/models/textrecog/decoders/crnn_decoder.py: class `Dictionary` in mmocr/models/common/dictionary/dictionary.py: [Errno 2] No such file or directory: 'd:/a/mmocr/mmocr/mmocr/.mim/configs/textrecog/crnn/../../../dicts/lower_english_digits.txt'

Which has to be manually fixed by running the command under mmocr\ root directory:

mklink /D mmocr\.mim\dicts dicts\

@codecov
Copy link

codecov bot commented Feb 2, 2023

Codecov Report

Base: 85.58% // Head: 88.42% // Increases project coverage by +2.84% 🎉

Coverage data is based on head (a0291b2) compared to base (2d743cf).
Patch coverage: 84.61% of modified lines in pull request are covered.

❗ Current head a0291b2 differs from pull request most recent head 7777a52. Consider uploading reports for the commit 7777a52 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           dev-1.x    #1608      +/-   ##
===========================================
+ Coverage    85.58%   88.42%   +2.84%     
===========================================
  Files          175      175              
  Lines        10950    10881      -69     
  Branches      1526     1523       -3     
===========================================
+ Hits          9372     9622     +250     
+ Misses        1313      979     -334     
- Partials       265      280      +15     
Flag Coverage Δ
unittests 88.42% <84.61%> (+2.84%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmocr/ocr.py 0.00% <0.00%> (ø)
mmocr/apis/inferencers/textspot_inferencer.py 35.71% <35.71%> (ø)
mmocr/apis/inferencers/textdet_inferencer.py 92.30% <80.00%> (+50.64%) ⬆️
mmocr/apis/inferencers/mmocr_inferencer.py 95.27% <88.63%> (+77.73%) ⬆️
mmocr/apis/inferencers/base_mmocr_inferencer.py 90.42% <95.00%> (+67.48%) ⬆️
mmocr/apis/inferencers/kie_inferencer.py 81.90% <97.87%> (+61.90%) ⬆️
mmocr/apis/inferencers/textrec_inferencer.py 100.00% <100.00%> (+40.00%) ⬆️
mmocr/datasets/transforms/loading.py 96.89% <100.00%> (+7.38%) ⬆️
mmocr/datasets/wildreceipt_dataset.py 100.00% <100.00%> (+4.00%) ⬆️
...cr/models/textdet/module_losses/pan_module_loss.py 89.10% <0.00%> (-7.70%) ⬇️
... and 19 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@gaotongxiao gaotongxiao merged commit ad470e3 into open-mmlab:dev-1.x Feb 2, 2023
@gaotongxiao gaotongxiao deleted the inferencer branch February 2, 2023 11:06
MeowZheng added a commit to open-mmlab/mmsegmentation that referenced this pull request Feb 23, 2023
## Motivation

Support `MMSegInferencer` for providing an easy and clean interface for
single or multiple images inferencing.

Ref: open-mmlab/mmengine#773
open-mmlab/mmocr#1608

## Modification

- mmseg/apis/mmseg_inferencer.py
- mmseg/visualization/local_visualizer.py
- demo/image_demo_with_inferencer.py

## Use cases (Optional)

Based on https://github.com/open-mmlab/mmengine/tree/inference

Add a new image inference demo with `MMSegInferencer`

- demo/image_demo_with_inferencer.py

```shell
python demo/image_demo_with_inferencer.py demo/demo.png fcn_r50-d8_4xb2-40k_cityscapes-512x1024
```

---------

Co-authored-by: MeowZheng <meowzheng@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docs] Installation does not provide clear examples that work on CPU
2 participants