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

Add online prediction of text direction classification (CLS) model #769

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zhangjunlongtech
Copy link

@zhangjunlongtech zhangjunlongtech commented Nov 15, 2024

Thank you for your contribution to the MindOCR repo.
Before submitting this PR, please make sure:

Motivation

Currently mobilenet_v3 classification (CLS) model only supports offline inference with mindspore lite. This PR is adding online mobilenet_v3 classification model inference for text angle classification (CLS) task. Add predict_cls.py for everyone to use.

Test Plan

Running the following command and check the output files under ./inferrence_results

python tools/infer/text/predict_cls.py  --image_dir {path_to_img or dir_to_imgs} --rec_algorithm MV3

We can also run in single image mode by setting --cls_batch_mode False.

python tools/infer/text/predict_cls.py  --image_dir {path_to_img or dir_to_imgs} --rec_algorithm MV3 --cls_batch_mode False

The target classification image is
CRNN_t2

The cls task output should looks like this

mindocr INFO - Init classification model: MV3 --> cls_mobilenet_v3_small_100_model. Model weights loaded from pretrained url
mindocr INFO - num images for cls: 1
mindocr INFO - CLS img idx range: [0, 1)
mindocr INFO - All cls res: [('180', 1.0)]
mindocr INFO - Done! Text angle classification results saved in ./inference_results
mindocr INFO - Time cost: 6.98498272895813, FPS: 0.14316427667805537

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.

1 participant