Answers.Body: <p>The libraries should allow you to specify the number of input channels of the convolutional layer, so no one should prevent you from passing 1-channel images as input to a CNN. For example, in PyTorch, you can specify the number of input channels of the <a href="https://pytorch.org/docs/stable/nn.html#conv2d" rel="nofollow noreferrer"><code>Conv2d</code></a> object. </p>
  
  <p>If your library does not provide such feature, you could convert your 1-channel images to 3-channel images, where e.g. all 3 channels of each image are equal to the only channel of the corresponding original 1-channel image.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-24T00:20:26.657Z
Answers.LastActivityDate: 2019-06-24T00:20:26.657Z
Answers.UserDisplayName: nbro
Answers.Body: <p>If you look at the theory of CNN, the no.of channels in the input layer is also a parameter that user can decide. In fact, if you are working on monochrome (black &amp; white) images, you have to use only one channel in the input layer. All the libraries should provide a way to design an input layer with no. of channels as an option. But, if you are trying to use transfer learning by using some model in the database, then you may be restricted to use 3 channel input because the model is designed so. </p>
  
  <p>There is no need to convert your images to RGB, surely there should be a way provided by the library you are using to use only 1 channel input. Or if you are writing your code, you can design your CNN with only 1 channel input. </p>
  
  <p><strong>3 channels is not a rule in CNN</strong></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-24T01:12:58.873Z
Answers.LastActivityDate: 2019-06-24T01:12:58.873Z
Answers.UserDisplayName: Kartik Podugu
Body: <p>I need to develop a convolutional neural network whose inputs are 1-channel images, but I dont know how to do it, given that most libraries use 3 channel images. Should I convert my images to RGB? Is there any way to implement a CNN that receive as input 1-channel images?</p>
  
Tags: <machine-learning><convolutional-neural-networks><computer-vision><supervised-learning>
Title: How can I use 1-channel images as input to a CNN?
UserDisplayName: manuel veras
ThreadText: # How can I use 1-channel images as input to a CNN?
  
  (Asked by: username_0 on 2019-06-23)
  
  I need to develop a convolutional neural network whose inputs are 1-channel images, but I dont know how to do it, given that most libraries use 3 channel images. Should I convert my images to RGB? Is there any way to implement a CNN that receive as input 1-channel images?
  
  **Tags:** machine-learning, convolutional-neural-networks, computer-vision, supervised-learning
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-06-24. Score: 1
  
  The libraries should allow you to specify the number of input channels of the convolutional layer, so no one should prevent you from passing 1-channel images as input to a CNN. For example, in PyTorch, you can specify the number of input channels of the [`Conv2d`](https://pytorch.org/docs/stable/nn.html#conv2d) object.
  
  If your library does not provide such feature, you could convert your 1-channel images to 3-channel images, where e.g. all 3 channels of each image are equal to the only channel of the corresponding original 1-channel image.
  
  
  ---
  
  ### Answer by username_2 on 2019-06-24. Score: 1
  
  If you look at the theory of CNN, the no.of channels in the input layer is also a parameter that user can decide. In fact, if you are working on monochrome (black & white) images, you have to use only one channel in the input layer. All the libraries should provide a way to design an input layer with no. of channels as an option. But, if you are trying to use transfer learning by using some model in the database, then you may be restricted to use 3 channel input because the model is designed so.
  
  There is no need to convert your images to RGB, surely there should be a way provided by the library you are using to use only 1 channel input. Or if you are writing your code, you can design your CNN with only 1 channel input.
  
  **3 channels is not a rule in CNN**
  
  
  ---
  
  