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

feat: add preserve aspect ratio to predictor and vizualisation utils #766

Merged
merged 3 commits into from
Dec 29, 2021

Conversation

charlesmindee
Copy link
Collaborator

@charlesmindee charlesmindee commented Dec 28, 2021

This PR allows to use the preserve_aspect_ratio flag in the predictor:

model = ocr_predictor(pretrained=True, assume_straight_pages=False, preserve_aspect_ratio=True)
doc = DocumentFile.from_images(path)
result = model(doc)
result.show(doc, preserve_aspect_ratio=True)

Yields:
ar

Instead of:
withourar

Any feedback is welcome!

@charlesmindee charlesmindee self-assigned this Dec 28, 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 28, 2021
@charlesmindee charlesmindee added this to the 0.5.0 milestone Dec 28, 2021
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 few improvement suggestions in the review!

doctr/io/elements.py Show resolved Hide resolved
doctr/io/elements.py Show resolved Hide resolved
doctr/models/zoo.py Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 29, 2021

Codecov Report

Merging #766 (2c333ae) into main (f2f1f21) will decrease coverage by 0.06%.
The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #766      +/-   ##
==========================================
- Coverage   96.19%   96.13%   -0.07%     
==========================================
  Files         129      129              
  Lines        4810     4812       +2     
==========================================
- Hits         4627     4626       -1     
- Misses        183      186       +3     
Flag Coverage Δ
unittests 96.13% <40.00%> (-0.07%) ⬇️

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

Impacted Files Coverage Δ
doctr/models/zoo.py 100.00% <ø> (ø)
doctr/utils/visualization.py 90.26% <25.00%> (-0.73%) ⬇️
doctr/io/elements.py 92.09% <100.00%> (ø)
doctr/models/recognition/predictor/tensorflow.py 91.17% <0.00%> (-5.89%) ⬇️

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 f2f1f21...2c333ae. 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.

Thanks again!

@charlesmindee charlesmindee merged commit 3fc71b1 into main Dec 29, 2021
@charlesmindee charlesmindee deleted the preserve branch December 29, 2021 11:31
@fg-mindee fg-mindee added the module: io Related to doctr.io label Dec 31, 2021
@charlesmindee charlesmindee added the type: breaking change Introducing a breaking change label Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: io Related to doctr.io module: models Related to doctr.models module: utils Related to doctr.utils topic: text detection Related to the task of text detection type: breaking change Introducing a breaking change type: enhancement Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants