Skip to content

Conversation

@interactivetech
Copy link

Hi there, This PR resolves issue #382. @miliadis and I worked together and successfully resolved this issue by having the aspect ratio and resize method adapt when width > height and height > width. Currently the cropped regions in horizontal_list and free_list are resized so the height fits the model_height(L523 and L543).

The image resizing is calculated by computing the aspect ratio, which is width/height (L522 and L542). Assuming the aspect ratio should only be calculated as width/height results in a bug when the cropped region resolution is reduced. When height>width, aspect ratio is <1.0, which results in the resolution of the image being significantly reduced. This then results in poor performance in the CRNN to recognize the text, even when you set the Reader to recognize in several orientations.

Our solution flips the resizing and aspect ratio calculation when the aspect ratio is < 1.0.

To ensure that the max_width is correctly captured, we also updated the make_rotated_img_list() function to capture the max_width in all orientation configurations.

Here is an example notebook that shows the latest EasyOCR performance on a simple text in vertical orientation.

https://colab.research.google.com/drive/1df-dv7IUF0AzaWUwizRspeHr59lm7aeP?authuser=1#scrollTo=-VepZ4LZXMD-

coronavirus_rotated
[([[1, 1], [21, 1], [21, 127], [1, 127]], 'W', 0.3783025082953806)]

And here is a demo with our solution showing EasyOCR can now recognize vertical text:

https://colab.research.google.com/drive/1uDXl8yd18LLPsnSd2jFZ3kj0B5_-lkjk?authuser=1#scrollTo=CU8FzHcoIgCv
coronavirus_rotated
[([[1, 1], [21, 1], [21, 127], [1, 127]], 'coronavirus', 0.6846225781041564)]

@rkcosmos rkcosmos merged commit 1c9bb05 into JaidedAI:master Jun 13, 2021
thuc-moreh pushed a commit to moreh-dev/EasyOCR that referenced this pull request Jul 5, 2023
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.

2 participants