You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
Hey guys. I have recently gone into a ML project and using ImageDataGenerator class to augment my image dataset
However, I think the color conversion done in BatchFromFilesMixin, when calling load_img from .utils should not be done there, but on ImageDataGenerator class.
The reasons I have is people, like me in this case, may want to write their own custom transformations for images. I know there is the preprocessing_function argument, but that doesn't solve all problems.
Check the following:
My dataset has both rgb and rgba images. In my case, I wanna add a random background to png images. I can't using ImageDataGenerator class due to the color conversion. And I can't also set color_mode to rgba because then it I won't know which images hadn't background at the beggining.
The easiest way to fix this for my particular case is removing the lines from load_img where the color conversion is done, so the image ImageDataGenerator class recieves, is the image as it is. If it has 1 channel, then 1 channel. If it has 3, then 3, and if it has 4, then 4.
Please correct me if I am wrong and also please if you know another way that allows me making this kind of augmentation
I am aware that if keras doesn't control the channels on ImageDataGenerator class, then the user must take care of it, so it matches the input layer shape of the model
The text was updated successfully, but these errors were encountered:
Hey guys. I have recently gone into a ML project and using
ImageDataGenerator
class to augment my image datasetHowever, I think the color conversion done in
BatchFromFilesMixin
, when callingload_img
from.utils
should not be done there, but onImageDataGenerator
class.The reasons I have is people, like me in this case, may want to write their own custom transformations for images. I know there is the
preprocessing_function
argument, but that doesn't solve all problems.Check the following:
My dataset has both rgb and rgba images. In my case, I wanna add a random background to png images. I can't using ImageDataGenerator class due to the color conversion. And I can't also set
color_mode
to rgba because then it I won't know which images hadn't background at the beggining.The easiest way to fix this for my particular case is removing the lines from
load_img
where the color conversion is done, so the imageImageDataGenerator
class recieves, is the image as it is. If it has 1 channel, then 1 channel. If it has 3, then 3, and if it has 4, then 4.Please correct me if I am wrong and also please if you know another way that allows me making this kind of augmentation
I am aware that if keras doesn't control the channels on
ImageDataGenerator
class, then the user must take care of it, so it matches the input layer shape of the modelThe text was updated successfully, but these errors were encountered: