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

fix: box computing when assume straight pages is false #720

Merged
merged 2 commits into from
Dec 17, 2021

Conversation

charlesmindee
Copy link
Collaborator

@charlesmindee charlesmindee commented Dec 15, 2021

This PR fixes the following:

  • angle computation in visualization.py
  • angle computation in fit_rbbox
  • Polygon expansion for rbbox: before this PR, we computed the area & perimeter of the polygon for the Vatti clipping algorithm from the raw polygon, now we compute it from the rotated rectangle which is more accurate and allow us to match the boxes when we have assume_straight_pages = False and assume_straight_pages = True.

before:
ex5

now:

ex3

@charlesmindee charlesmindee self-assigned this Dec 15, 2021
@charlesmindee charlesmindee added type: enhancement Improvement module: models Related to doctr.models module: utils Related to doctr.utils topic: text detection Related to the task of text detection labels Dec 15, 2021
@charlesmindee charlesmindee added this to the 0.5.0 milestone Dec 15, 2021
@fg-mindee fg-mindee self-requested a review December 15, 2021 15:20
Copy link
Contributor

@fg-mindee fg-mindee left a comment

Choose a reason for hiding this comment

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

Thanks a lot! Only a small question about the box fitting function in comment

doctr/utils/geometry.py Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 15, 2021

Codecov Report

Merging #720 (44c3686) into main (cf97d9e) will decrease coverage by 0.03%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #720      +/-   ##
==========================================
- Coverage   96.12%   96.09%   -0.04%     
==========================================
  Files         124      125       +1     
  Lines        4648     4714      +66     
==========================================
+ Hits         4468     4530      +62     
- Misses        180      184       +4     
Flag Coverage Δ
unittests 96.09% <91.66%> (-0.04%) ⬇️

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

Impacted Files Coverage Δ
doctr/utils/visualization.py 92.03% <0.00%> (ø)
...dels/detection/differentiable_binarization/base.py 90.37% <100.00%> (-0.19%) ⬇️
doctr/utils/geometry.py 98.00% <100.00%> (ø)
doctr/models/builder.py 96.49% <0.00%> (-2.64%) ⬇️
doctr/io/pdf.py 100.00% <0.00%> (ø)
doctr/datasets/__init__.py 100.00% <0.00%> (ø)
doctr/datasets/svhn.py 94.73% <0.00%> (ø)
doctr/models/detection/linknet/base.py 87.12% <0.00%> (+1.98%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf97d9e...44c3686. Read the comment docs.

Copy link
Contributor

@fg-mindee fg-mindee left a comment

Choose a reason for hiding this comment

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

Let's keep in mind that the angle is off by 90°, but the rest is fine!

@charlesmindee charlesmindee merged commit 0fe5015 into main Dec 17, 2021
@charlesmindee charlesmindee deleted the rotationfix branch December 17, 2021 09:37
@fg-mindee fg-mindee added ext: tests Related to tests folder type: bug Something isn't working and removed type: enhancement Improvement labels Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext: tests Related to tests folder module: models Related to doctr.models module: utils Related to doctr.utils topic: text detection Related to the task of text detection type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants