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

[Docs] How to use TextDetInferencer #2068

Open
zfxw opened this issue Oct 10, 2024 · 0 comments
Open

[Docs] How to use TextDetInferencer #2068

zfxw opened this issue Oct 10, 2024 · 0 comments
Assignees

Comments

@zfxw
Copy link

zfxw commented Oct 10, 2024

Branch

master branch https://github.com/open-mmlab/mmocr

📚 The doc issue

I trained a Textdet model with my own data, I can see a good detection result with following command
python tools/test.py ~/mmocr/work_dirs/dbnet_resnet18_fpnc_1200e_blfsh/dbnet_resnet18_fpnc_1200e_blfsh.py ~/mmocr/work_dirs/dbnet_resnet18_fpnc_1200e_blfsh/epoch_400.pth --show-dir imgs/.

But when I tried to use TextDetInferencer with following code

from mmocr.apis import TextDetInferencer

# Load models into memory
infer = TextDetInferencer(model='<Home>/mmocr/work_dirs/dbnet_resnet18_fpnc_1200e_blfsh/dbnet_resnet18_fpnc_1200e_blfsh.py', weights='<Home>/mmocr/work_dirs/dbnet_resnet18_fpnc_1200e_blfsh/epoch_400.pth', scope='mmocr')

# Perform inference
result = infer('<Home>/BLFSH_training_data/OpenMM_textbox_training_data/test/202402020_124623_cr02.png')
print(result)

All the bounding boxes are out of image bounds, and here is the error:

10/10 21:06:44 - mmengine - WARNING - Failed to search registry with scope "mmocr" in the "function" registry tree. As a workaround, the current "function" registry in "mmengine" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmocr" is a correct scope, or whether the registry is initialized.
/opt/conda/miniconda3/lib/python3.8/site-packages/mmengine/visualization/visualizer.py:196: UserWarning: Failed to add <class 'mmengine.visualization.vis_backend.LocalVisBackend'>, please provide the `save_dir` argument.
  warnings.warn(f'Failed to add {vis_backend.__class__}, '
/opt/conda/miniconda3/lib/python3.8/site-packages/mmengine/visualization/visualizer.py:831: UserWarning: Warning: The polygon is out of 
bounds, the drawn polygon may not be in the image

Why the polygon could be out of the bounds? Am I using TextDetInferencer properly?

I really appreciate if you can help. Thank you

Suggest a potential alternative/fix

No response

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

No branches or pull requests

2 participants