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 RandomHorizontalFLip in TF #779

Merged
merged 8 commits into from
Jan 3, 2022
Merged

Conversation

SiddhantBahuguna
Copy link
Contributor

@SiddhantBahuguna SiddhantBahuguna commented Dec 31, 2021

This PR adds the following changes to the existing PR:

It adds RandomHorizontalFlip implementation in tensorflow. It transforms both the image and the target(with bboxes in relative coordinates)

      from doctr.transforms import RandomHorizontalFlip
       >>> import tensorflow as tf
       >>> transfo = RandomHorizontalFlip(p=0.5)
       >>> image = tf.random.uniform(shape=[64, 64, 3], minval=0, maxval=1)
       >>> target = {
        "boxes": np.array([[0.1, 0.1, 0.4, 0.5] ], dtype= np.float32),
        "labels": np.ones(1, dtype= np.int64)
        }
       >>> out = transfo(image, target)

It adds a unitest for the same

It adds RandomHorizontalFlip in the documentation

@SiddhantBahuguna SiddhantBahuguna added type: enhancement Improvement ext: tests Related to tests folder module: transforms Related to doctr.transforms framework: tensorflow Related to TensorFlow backend labels Dec 31, 2021
@SiddhantBahuguna SiddhantBahuguna self-assigned this Dec 31, 2021
@codecov
Copy link

codecov bot commented Dec 31, 2021

Codecov Report

Merging #779 (21ce24e) into main (e5ca2d5) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #779   +/-   ##
=======================================
  Coverage   95.99%   96.00%           
=======================================
  Files         130      130           
  Lines        4870     4882   +12     
=======================================
+ Hits         4675     4687   +12     
  Misses        195      195           
Flag Coverage Δ
unittests 96.00% <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/tensorflow.py 93.05% <100.00%> (+0.63%) ⬆️

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 e5ca2d5...21ce24e. 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! Still need to add the entry in the documentation, but I added a few comments 👌

doctr/transforms/modules/tensorflow.py Outdated Show resolved Hide resolved
doctr/transforms/modules/tensorflow.py Show resolved Hide resolved
doctr/transforms/modules/tensorflow.py Outdated Show resolved Hide resolved
@fg-mindee fg-mindee added type: new feature New feature and removed type: enhancement Improvement labels Dec 31, 2021
@SiddhantBahuguna SiddhantBahuguna added the ext: docs Related to docs folder label Dec 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.

Looks good! The failed test is not related and will be fixed by #781 (to be merged before this one)

@SiddhantBahuguna SiddhantBahuguna merged commit 8d271ea into main Jan 3, 2022
@SiddhantBahuguna SiddhantBahuguna deleted the tf_randhorizontalflip branch January 3, 2022 14:24
@fg-mindee fg-mindee mentioned this pull request Jan 10, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext: docs Related to docs folder ext: tests Related to tests folder framework: tensorflow Related to TensorFlow backend module: transforms Related to doctr.transforms type: new feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants