How to use single channel input for extracting feature by pretrained VGG model?

i would like to extract some layers feature by pretrained VGG models, but which requires 3-channels input, my input image just has single channel, what should i do for it ? thanks!

You could load your grayscale image and convert it to an RGB one.
E.g. if you are using PIL, you can call'your_path').convert('RGB').

Alternatively you could add a conv layer at the beginning of your model, which takes in_channels=1 and returns out_channels=3. Since this layer would need training, I would try the first approach to get the features.

thank you! i have solved it by conveting it to 3 channel.