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: Added Random Horizontal Flip augmentation #773

Merged
merged 8 commits into from
Dec 30, 2021
Merged

Conversation

SiddhantBahuguna
Copy link
Contributor

@SiddhantBahuguna SiddhantBahuguna commented Dec 30, 2021

This PR introduces the following changes:

  • It adds Random horizontal Flip as an augmentation that transforms images as well as the labels.

         from doctr.transforms import RandHorizontalFlip
         import torch; import numpy as np
         transformed = RandHorizontalFlip(p = 0.5)
         target = {"boxes": np.array([[0.1, 0.1, 0.4, 0.5] ], dtype= np.float32), "labels": np.ones(1, dtype= np.int64)}
         image, target = transformed(torch.rand((3, 224, 224)), target)
    

horizontal

  • It adds a uniitest for the same

Any feedback is welcome!

@SiddhantBahuguna SiddhantBahuguna added type: enhancement Improvement ext: tests Related to tests folder ext: references Related to references folder module: transforms Related to doctr.transforms topic: object detection Related to the task of object detection labels Dec 30, 2021
@SiddhantBahuguna SiddhantBahuguna added this to the 0.5.0 milestone Dec 30, 2021
@SiddhantBahuguna SiddhantBahuguna self-assigned this Dec 30, 2021
@codecov
Copy link

codecov bot commented Dec 30, 2021

Codecov Report

Merging #773 (150fb25) into main (f5b6375) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 150fb25 differs from pull request most recent head 2142583. Consider uploading reports for the commit 2142583 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main     #773      +/-   ##
==========================================
- Coverage   95.93%   95.93%   -0.01%     
==========================================
  Files         129      129              
  Lines        4845     4866      +21     
==========================================
+ Hits         4648     4668      +20     
- Misses        197      198       +1     
Flag Coverage Δ
unittests 95.93% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
doctr/transforms/modules/pytorch.py 98.30% <100.00%> (+0.30%) ⬆️
doctr/transforms/modules/tensorflow.py 92.42% <0.00%> (-0.08%) ⬇️

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 f5b6375...2142583. Read the comment docs.

@fg-mindee fg-mindee self-requested a review December 30, 2021 15:38
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!

@fg-mindee fg-mindee added the framework: pytorch Related to PyTorch backend label Dec 30, 2021
@fg-mindee fg-mindee merged commit 0b15ad1 into main Dec 30, 2021
@fg-mindee fg-mindee deleted the horizontalflip_aug branch December 30, 2021 15:47
@fg-mindee fg-mindee added type: new feature New feature and removed type: enhancement Improvement labels Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext: references Related to references folder ext: tests Related to tests folder framework: pytorch Related to PyTorch backend module: transforms Related to doctr.transforms topic: object detection Related to the task of object detection type: new feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants