isht7 / pytorch-deeplab-resnet

DeepLab resnet v2 model in pytorch
MIT License
602 stars 118 forks source link

Can I train gray images using this code? #24

Closed shonehang closed 6 years ago

shonehang commented 6 years ago

I trained RGB images before, which have 3 channels. Now I want to train gray images that have only one channel. How should I modify this code? Thank you very much!

isht7 commented 6 years ago

yes, will work, just convert all images which have a single channel to a 3 channel image by repeating the same 2d matrix across all 3 channels. Put a line after this line to do so. Your line should be something like rgb = np.repeat(grey[:, :, np.newaxis], 3, 2).

shonehang commented 6 years ago

Thank you very much! I will try it according to your advice soon.