Transform pictures to grayscale and then train

Hi everyone,

i am dealing with a fashion images dataset. One thing i dont want is the color of the clothes to be a discriminant in the result because i am trying to actually predict shapes/styles of these clothes.
Is there a way i can automatically turn my training images to greyscale when i create my databunch? maybe adding something to get_transforms?

Thanks in advance,
Marco

1 Like

I think that torchvision.transforms.Grayscale() is what you’re looking for. It’s not available as shortcut in the get_transforms() function definition, but I think you can just pass it as xtra_tfms parameter.

1 Like