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 RandomCrop module in transforms #448

Merged
merged 15 commits into from
Aug 31, 2021
Merged

feat: add RandomCrop module in transforms #448

merged 15 commits into from
Aug 31, 2021

Conversation

charlesmindee
Copy link
Collaborator

This PR adds RandomCrop in transforms/base.py, and updates the detection dataset with a geometric_transforms args to compose both RandomCrop and RandomRotate.

Any feedback is welcome!

NB: cropping should be performed BEFORE rotation, because it is lighter that way (less information to deal with), and also because the rotation transformation converts boxes to rotated boxes whereas cropping is performed with straight bounding boxes.

@charlesmindee charlesmindee self-assigned this Aug 30, 2021
@charlesmindee charlesmindee added type: enhancement Improvement framework: pytorch Related to PyTorch backend framework: tensorflow Related to TensorFlow backend module: datasets Related to doctr.datasets module: transforms Related to doctr.transforms labels Aug 30, 2021
@charlesmindee charlesmindee added this to the 0.4.0 milestone Aug 30, 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 for the PR!

I think we should keep this PR about the sole implementation of the cropping augmentation (and handle the integration of img+target transforms in the datasets in another PR), cf my comments :)

doctr/transforms/functional/pytorch.py Outdated Show resolved Hide resolved
doctr/transforms/functional/tensorflow.py Outdated Show resolved Hide resolved
doctr/transforms/modules/base.py Outdated Show resolved Hide resolved
doctr/datasets/detection.py Outdated Show resolved Hide resolved
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 for the edits! Only a few comments left

doctr/transforms/modules/base.py Outdated Show resolved Hide resolved
doctr/transforms/modules/base.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 31, 2021

Codecov Report

Merging #448 (d84e655) into main (d2fef17) will decrease coverage by 0.00%.
The diff coverage is 95.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #448      +/-   ##
==========================================
- Coverage   95.84%   95.83%   -0.01%     
==========================================
  Files          96       96              
  Lines        3997     4014      +17     
==========================================
+ Hits         3831     3847      +16     
- Misses        166      167       +1     
Flag Coverage Δ
unittests 95.83% <95.23%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
doctr/transforms/modules/base.py 91.22% <95.23%> (+1.22%) ⬆️

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 d2fef17...d84e655. 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 ! Looks good to me, could you add an entry in the documentation please? 🙏

@fg-mindee fg-mindee added the topic: documentation Improvements or additions to documentation label Aug 31, 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.

Cheers!

@charlesmindee charlesmindee merged commit 51c961f into main Aug 31, 2021
@charlesmindee charlesmindee deleted the geometric branch August 31, 2021 13:06
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 framework: tensorflow Related to TensorFlow backend module: datasets Related to doctr.datasets module: transforms Related to doctr.transforms topic: documentation Improvements or additions to documentation type: enhancement Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants