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 detection post-processing #724

Merged
merged 9 commits into from
Dec 17, 2021
Merged

refactor: Refactored detection post-processing #724

merged 9 commits into from
Dec 17, 2021

Conversation

fg-mindee
Copy link
Contributor

This PR introduces the following modifications:

  • speeds up and clean the binarization of the probability map and the opening transform
  • makes it flexible enough to handle multi-channel outputs
  • reflects changes in DB & LinkNet to stick with single-channel output

After comparing latency with the option of switching to PyTorch & TF implementations of the opening transform, I reverted back the changes for one reason: on CPU & GPU, it was all faster except for TensorFlow on CPU that takes ~4-6 times longer to compute the opening transform (max_pool2d seems to be really slow on TF for CPU 🤷‍♂️ )

Any feedback is welcome!

@fg-mindee fg-mindee added type: enhancement Improvement module: models Related to doctr.models topic: object detection Related to the task of object detection labels Dec 16, 2021
@fg-mindee fg-mindee added this to the 0.5.0 milestone Dec 16, 2021
@fg-mindee fg-mindee self-assigned this Dec 16, 2021
charlesmindee
charlesmindee previously approved these changes Dec 17, 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!

@codecov
Copy link

codecov bot commented Dec 17, 2021

Codecov Report

Merging #724 (4357783) into main (6a591b0) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #724      +/-   ##
==========================================
- Coverage   96.03%   96.03%   -0.01%     
==========================================
  Files         125      125              
  Lines        4717     4713       -4     
==========================================
- Hits         4530     4526       -4     
  Misses        187      187              
Flag Coverage Δ
unittests 96.03% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
doctr/models/detection/core.py 96.96% <100.00%> (-0.33%) ⬇️
...s/detection/differentiable_binarization/pytorch.py 98.37% <100.00%> (ø)
...etection/differentiable_binarization/tensorflow.py 97.36% <100.00%> (ø)
doctr/models/detection/linknet/pytorch.py 98.07% <100.00%> (ø)
doctr/models/detection/linknet/tensorflow.py 100.00% <100.00%> (ø)

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 6a591b0...4357783. Read the comment docs.

@fg-mindee fg-mindee merged commit 2a18dc4 into main Dec 17, 2021
@fg-mindee fg-mindee deleted the flex-det-pp branch December 17, 2021 18:33
@fg-mindee fg-mindee added the ext: tests Related to tests folder label 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 topic: object detection Related to the task of object detection type: enhancement Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants