usuyama/pytorch-unet

Grayscale Images

ayaanzhaque opened this issue · 2 comments

Hi, How do I change the model to input grayscale images instead of 3 channel images?
Thanks

@ayaanzhaque

One way is to convert your grayscale images to 3 channels (just repeat 3 times).
e.g. https://stackoverflow.com/questions/50243709/how-to-convert-a-1-channel-image-into-a-3-channel-with-pil

Another way is to change the input shape of the model or add one layer to take 1 channel input.

Ok thanks, I figured it out! I just changed conv1 of the Resnet to single channeled.