How should I modify a CNN to take input of 1 channel images?

Viewed 31

I am working on a image compressing problem. The network I am studying is the CompressAI from GitHub: https://github.com/InterDigitalInc/CompressAI.

I want to modify the network to take input images of 1 channel and I do not know where should I get started. I think about other method such as changing 1 channel to 3 channels by duplicating 3 times, but that does not seem to fit the scope of "image compressing". Please, any suggestion where I shoud get start?

1 Answers

Looking at the official repository code here at line 56 the architecture for mbt2018 model is mentioned as JointAutoregressiveHierarchicalPriors. So the same model's input channels need to be changed. This can be done by changing the definition for the model located here. Change line 411 of the file from:

conv(3, N, kernel_size=5, stride=2),

to

conv(1, N, kernel_size=5, stride=2),

This ensures that the model now works for single channel images.

Related