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: Added safeguard for extreme aspect ratio in Resize #695

Merged
merged 1 commit into from
Dec 10, 2021

Conversation

fg-mindee
Copy link
Contributor

This PR fixes the second part of the unittest failures: now that we're positive no crop is 0-sized, in rare cases, preserving the aspect ratio can lead to a 0-sized intermediate image size.

This should not be encountered for trained models but this PR adds a clipping to 1 pixel in case this happens!

Any feedback is welcome!

@fg-mindee fg-mindee added type: bug Something isn't working module: models Related to doctr.models framework: pytorch Related to PyTorch backend topic: text recognition Related to the task of text recognition labels Dec 10, 2021
@fg-mindee fg-mindee added this to the 0.5.0 milestone Dec 10, 2021
@fg-mindee fg-mindee self-assigned this Dec 10, 2021
@codecov
Copy link

codecov bot commented Dec 10, 2021

Codecov Report

Merging #695 (37b32d6) into main (74d9e65) will decrease coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #695      +/-   ##
==========================================
- Coverage   96.16%   96.08%   -0.09%     
==========================================
  Files         124      124              
  Lines        4647     4647              
==========================================
- Hits         4469     4465       -4     
- Misses        178      182       +4     
Flag Coverage Δ
unittests 96.08% <100.00%> (-0.09%) ⬇️

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

Impacted Files Coverage Δ
doctr/transforms/modules/pytorch.py 100.00% <100.00%> (ø)
...dels/detection/differentiable_binarization/base.py 90.00% <0.00%> (-2.78%) ⬇️
doctr/models/builder.py 96.49% <0.00%> (-2.64%) ⬇️
doctr/models/detection/linknet/base.py 87.12% <0.00%> (+3.96%) ⬆️

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 74d9e65...37b32d6. Read the comment docs.

Copy link
Collaborator

@charlesmindee charlesmindee left a comment

Choose a reason for hiding this comment

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

Thanks!

@fg-mindee fg-mindee merged commit a612578 into main Dec 10, 2021
@fg-mindee fg-mindee deleted the resize-safeguard branch December 10, 2021 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework: pytorch Related to PyTorch backend module: models Related to doctr.models topic: text recognition Related to the task of text recognition type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants