-
Notifications
You must be signed in to change notification settings - Fork 7.1k
transforms: randomly grayscaling an image #325
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you add some simple tests to check that to_grayscale
returns the expected number of channels and data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you add some simple tests to check that to_grayscale returns the expected number of channels and data?
|
@sourabhd Thanks for making the changes. There seems to be some merge conflicts with master that need to be resolved before we can merge |
@alykhantejani RandomRotation and RandomGrayscale seem to be added at the same time in same files. Not a real conflict - just need to move lines of code and it should be fine. Write access is needed for merge, which I do not have. |
@sourabhd yup, I can do the merge once the conflict is resolved. Can you do this locally and push to origin? i.e.: git remote add upstream [email protected]:pytorch/vision.git
git pull upstream master
<this will cause a merge conflict>
<fix conflict>
git commit -am "merge upstream"
git push origin master |
test/test_transforms.py
Outdated
np.testing.assert_equal(gray_np_4[:, :, 1], gray_np_4[:, :, 2]) | ||
np.testing.assert_equal(gray_np, gray_np_4[:, :, 0]) | ||
|
||
# Set 2: Randomly grayscale image |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
""" | ||
|
||
def __init__(self, p=0.1): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Added transform for data augmetation technique where an image is grayscaled with probability p. The grayscaled version of image can be three channel (r == g == b) or single channel.
For detailed discussion of this feature please refer to issue #299