-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[Feature] Add transforms for randomly converting image to grayscale #299
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
Comments
Hi @sourabhd, I've taken a quick look at the code and it seems like you convert an image to grayscale and then back to RGB (repeating the grayscale image 3 times). I'm not sure when you would want to do this, i.e. if your dataset is a mix of RGB and grayscale images I would think you would either want all grayscale images (single channel) or to convert the grayscale ones to 3-channel grayscale and mix these with the RGB ones. A mix of single channel and 3 channel images wouldn't make sense as your network needs to know the number of input channels? |
|
So I think that this could go both ways i.e. the user wants to change 3-channel images to single channel grayscale or the user wants to change 1-channel images to 3-channel ones. I think a Additionally, depending on the users preference, it should be easy for them to encapsulate their desired behavior into a function (using PIL's convert/stack) and chain these together in a @fmassa wdyt? |
@alykhantejani In that case we could have two functions to_grayscale_singlechannel and to_grayscale_threechannel. |
@sourabhd yeah, I'd be happy with a |
Fixed via #325 |
Data augmentation (transform) for randomly converting image into grayscale (with probability p) is useful for handling datasets containing a mix of rgb and grayscale images.
Please check my implementation here
Let me know if this looks reasonable addition. I could send a pull request for the same.
The text was updated successfully, but these errors were encountered: