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

Text recognition crnn #176

Merged
merged 8 commits into from
Aug 8, 2023
Merged

Conversation

LaurentBerger
Copy link
Contributor

@LaurentBerger LaurentBerger force-pushed the text_recognition_crnn branch 2 times, most recently from 4177989 to ffa6beb Compare June 13, 2023 13:53
models/text_recognition_crnn/demo.cpp Outdated Show resolved Hide resolved
models/text_recognition_crnn/demo.cpp Outdated Show resolved Hide resolved
@WanliZhong
Copy link
Member

@LaurentBerger Hi, thanks for contribution, this PR need to update readme document.

Copy link
Member

@WanliZhong WanliZhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!👍👍👍, here are something I think need to be modified.

# detect on camera input
./build/opencv_zoo_text_recognition_crnn
# detect on an image
./build/opencv_zoo_text_recognition_crnn --input /path/to/image -v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to use -i=/path/to/image or --input=/path/to/image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using -v flag can't show the image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./build/opencv_zoo_text_recognition_crnn -v=0
show result as text but won't stop without ctrl+c. Must I add a counter to stop after 100 inferences?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just be as consistent as possible with other demos

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using -v flag can't show the image

Just modify the doc here to make sure the commands work. It does not worth making 100% same behavior as Python demos.


```shell
# detect on camera input
./build/opencv_zoo_text_recognition_crnn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this command can't recognize from camera.

models/text_recognition_crnn/README.md Outdated Show resolved Hide resolved
models/text_recognition_crnn/demo.cpp Outdated Show resolved Hide resolved
models/text_recognition_crnn/demo.cpp Outdated Show resolved Hide resolved
models/text_recognition_crnn/demo.cpp Outdated Show resolved Hide resolved
models/text_recognition_crnn/demo.cpp Outdated Show resolved Hide resolved
Comment on lines +82 to +84
./build/opencv_zoo_text_recognition_crnn --model=text_recognition_CRNN_CN_2021nov.onnx --charset=charset_3944_CN.txt
# detect on an image
./build/opencv_zoo_text_recognition_crnn --input=/path/to/image --model=text_recognition_CRNN_CN_2021nov.onnx --charset=charset_3944_CN.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--charset=charset_3944_CN.txt I dont see we have this file in this pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be there is something I don't understand : in readme

Selected model must match with the charset:

    Try text_recognition_CRNN_EN_2021sep.onnx with charset_36_EN.txt.
    Try text_recognition_CRNN_CH_2021sep.onnx with charset_94_CH.txt
    Try text_recognition_CRNN_CN_2021sep.onnx with charset_3944_CN.txt.

Then i understand that model gives charset to use then in code I use those line

        if (this->modelPath.find("_EN_") != string::npos)
            this->charset = loadCharset("CHARSET_EN_36");
        else if (this->modelPath.find("_CH_") != string::npos)
            this->charset = loadCharset("CHARSET_CH_94");
        else if (this->modelPath.find("_CN_") != string::npos)
            this->charset = loadCharset("CHARSET_CN_3944");
        else
        {
            CV_Error(-1, "Charset not supported! Exiting ...");

        }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We integrated charset characters into the class wrapper crnn.py from separate files, but forgot to update the information in readme. So the current readme is outdated, you might update in this pull request as well.

Copy link
Member

@fengyuentau fengyuentau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@fengyuentau fengyuentau merged commit 9aa1562 into opencv:main Aug 8, 2023
@fengyuentau fengyuentau self-assigned this Aug 8, 2023
@fengyuentau fengyuentau added the demo anything related to demo in Python / C++ label Aug 8, 2023
@WanliZhong WanliZhong added this to the 4.9.0 (first release) milestone Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demo anything related to demo in Python / C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants