liznerski / fcdd

Repository for the Explainable Deep One-Class Classification paper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Training on grayscale images

NimaDL opened this issue · comments

The code only accept RGB input data for the training and when I tried to feed grayscale images to the model it failed. Any idea how to modify the code to accept grayscale images

Hi!

For custom data?

Quick and dirty solution: Just repeat the channels for all images. For example, you could add transforms.Grayscale(num_output_channels=3), to the data pre-processing pipeline here and here.

The clean solution is defining a network architecture that works with grayscale images. Instead of 3 channels, the first layer needs to expect one channel. For our non-pretrained VGG variant, you need to change the first layer to self._create_conv2d(1, 64, 3, 1, 1),. Note that per default the custom data trainer uses the pretrained variant.

Thank you for your answer.