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

refactor: Refactored API of doctr.models #481

Merged
merged 8 commits into from
Sep 20, 2021
Merged

Conversation

fg-mindee
Copy link
Contributor

@fg-mindee fg-mindee commented Sep 20, 2021

This PR introduces the following modifications:

  • cleaned the __init__ files of doctr.models to keep only the relevant modules accessible (private modules that will see their API change in the future are better left out of this)
  • moved DocumentBuilder from doctr/models/core.py to doctr/models/builder.py
  • merged DetectionModel and RecognitionModel into BaseModel
  • each predictor class is now split into its implementations in PyTorch & TensorFlow via the same dispatch mechanism as previously (for more specific operations, typing and interface)
  • move crop split from doctr/models/recognition/core.py to doctr/models/recognition/base.py
  • updated unittests
  • updated API
  • updated demo

Any feedback is welcome!

@fg-mindee fg-mindee added type: enhancement Improvement module: models Related to doctr.models ext: tests Related to tests folder framework: pytorch Related to PyTorch backend framework: tensorflow Related to TensorFlow backend labels Sep 20, 2021
@fg-mindee fg-mindee added this to the 0.4.0 milestone Sep 20, 2021
@fg-mindee fg-mindee self-assigned this Sep 20, 2021
@codecov
Copy link

codecov bot commented Sep 20, 2021

Codecov Report

Merging #481 (1bcbbe4) into main (e134da4) will decrease coverage by 0.44%.
The diff coverage is 83.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #481      +/-   ##
==========================================
- Coverage   95.42%   94.97%   -0.45%     
==========================================
  Files          97      108      +11     
  Lines        4065     4160      +95     
==========================================
+ Hits         3879     3951      +72     
- Misses        186      209      +23     
Flag Coverage Δ
unittests 94.97% <83.97%> (-0.45%) ⬇️

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

Impacted Files Coverage Δ
doctr/models/__init__.py 100.00% <ø> (ø)
doctr/models/detection/__init__.py 100.00% <ø> (ø)
doctr/models/recognition/__init__.py 100.00% <ø> (ø)
doctr/models/predictor/pytorch.py 38.46% <38.46%> (ø)
doctr/models/recognition/predictor/base.py 51.61% <51.61%> (ø)
doctr/models/recognition/predictor/pytorch.py 87.87% <87.87%> (ø)
doctr/models/recognition/predictor/tensorflow.py 91.17% <91.17%> (ø)
doctr/models/builder.py 93.00% <93.00%> (ø)
doctr/models/detection/predictor/pytorch.py 94.44% <94.44%> (ø)
doctr/models/core.py 100.00% <100.00%> (+5.38%) ⬆️
... and 24 more

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 e134da4...1bcbbe4. Read the comment docs.

charlesmindee
charlesmindee previously approved these changes Sep 20, 2021
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 for the PR!

@fg-mindee fg-mindee added ext: api Related to api folder ext: demo Related to demo folder labels Sep 20, 2021
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 ab7d483 into main Sep 20, 2021
@fg-mindee fg-mindee deleted the predictor-refactor branch September 20, 2021 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext: api Related to api folder ext: demo Related to demo folder ext: tests Related to tests folder framework: pytorch Related to PyTorch backend framework: tensorflow Related to TensorFlow backend module: models Related to doctr.models type: enhancement Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants