Answers.Body: <blockquote>
    <p>After inner product, add them all to make one feature map. Am I right?</p>
  </blockquote>
  
  <p><strong>yes</strong>, you are right.</p>
  
  <blockquote>
    <p>Then, can I reduce the number of weights in the filters? Because in this case, using three different n×n filters and adding them is same with using one n×n filter that is the summation of three filters.</p>
  </blockquote>
  
  <p>If you have transformed the image into greyscale then you no longer need 3 filters. You should retrain your model on greyscale images. In a greyscale image the value of each pixel is a single sample representing only an amount of light (the light intensity).</p>
  
  <p>The network will run faster if that is the only architectural change you make, but keep in mind that by converting the image to greyscale you will lose information and probably some of the predictive power of your network.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T10:30:30.187Z
Answers.Text: Thanks for your comment.
  So greyscale image is the one-channel image, right?
  But I can't retrain it because I don't have training samples.
  What if I use RGB image with same values for each channel?
  It would be same with one channel grey scale image.
Answers.UserDisplayName: Jun
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T10:42:48.050Z
Answers.Text: No. It will almost certainly work badly. Each of the three RGB channels contains information about the light intensity for each of those colours. You may get some results by selecting a channel and its filter (e.g using only the red channel and filter for each image) and upscaling the weights, but this will certainly badly reduce the accuracy of your network. Also, if you have many hidden layers the performance improvement will be very small since the amount of computation after the first CNN layer will be exactly the same.
Answers.UserDisplayName: Mike Vella
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T12:39:35.507Z
Answers.Text: Colour is very important to classify images. Imagine fruit for example, which rely a lot of the color of the object.
Answers.UserDisplayName: Jérémy Blain
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T10:22:01.480Z
Answers.LastActivityDate: 2018-09-13T10:22:01.480Z
Answers.UserDisplayName: Mike Vella
Body: <p><a href="https://ai.stackexchange.com/questions/5769/in-a-cnn-does-each-new-filter-have-different-weights-for-each-input-channel-or">In a CNN, does each new filter have different weights for each input channel, or are the same weights of each filter used across input channels?</a></p>
  
  <p>This question helps me a lot.</p>
  
  <p>Let, I have RGB input image. (3 channels)
  Then each filter has n×n weights for one channel.
  It means, actually the filter has totally 3×n×n weights.</p>
  
  <p>For channel R, it has own n×n filter.</p>
  
  <p>For channel G, it has own n×n filter.</p>
  
  <p>For channel B, it has own n×n filter.</p>
  
  <p>After inner product, add them all to make one feature map.
  Am I right?</p>
  
  <p>And then, my question starts here.
  For some purpose, I will only use greyscale images as input.
  So the input images always have the same values for each RGB channel.</p>
  
  <p>Then, can I reduce the number of weights in the filters?
  Because in this case, using three different n×n filters and adding them is same with using one n×n filter that is the summation of three filters.</p>
  
  <p>Does this logic hold on a trained network?
  I have a trained network for RGB image input, but it is too heavy to run in real time.
  But I only use the greyscale images as input, so it seems I can make the network less heavy (theoretically, almost 1/3 of original).</p>
  
  <p>I'm quite new in this field, so detailed explanations will be really appreciated.
  Thank you.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-13T10:30:12.597Z
Comments.Text: Yes, right. And it's impossible to retrain because I don't have training set...
Comments.UserDisplayName: Jun
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-13T10:30:57.093Z
Comments.Text: Sum up : No you don't reduce your number of weights by 3, you reduce your first layer number of weights by 3 only !
Comments.UserDisplayName: Jérémy Blain
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-13T10:31:54.833Z
Comments.Text: @Jun Then maybe you should stay with the former CNN model. Or maybe try to reduce the number of weights, but it's not obvious that the network works better....
Comments.UserDisplayName: Jérémy Blain
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-13T10:47:04.323Z
Comments.Text: Unless you have some very unusual images (e.g mostly one colour) then this is a very bad way to improve inference performance as anything you do will badly affect accuracy. If you don't have access to training data to retrain a network you should look into other routes (e.g TensorRT or better hardware) to improve inference performance.
Comments.UserDisplayName: Mike Vella
Tags: <deep-learning><convolutional-neural-networks><signal-processing>
Title: Can I reduce the "number of weights" in CNN to 1/3 by restricting the input as greyscale image?
UserDisplayName: Jun
ThreadText: # Can I reduce the "number of weights" in CNN to 1/3 by restricting the input as greyscale image?
  
  (Asked by: username_0 on 2018-09-13)
  
  [In a CNN, does each new filter have different weights for each input channel, or are the same weights of each filter used across input channels?](https://ai.stackexchange.com/questions/5769/in-a-cnn-does-each-new-filter-have-different-weights-for-each-input-channel-or)
  
  This question helps me a lot.
  
  Let, I have RGB input image. (3 channels)
  Then each filter has n×n weights for one channel.
  It means, actually the filter has totally 3×n×n weights.
  
  For channel R, it has own n×n filter.
  
  For channel G, it has own n×n filter.
  
  For channel B, it has own n×n filter.
  
  After inner product, add them all to make one feature map.
  Am I right?
  
  And then, my question starts here.
  For some purpose, I will only use greyscale images as input.
  So the input images always have the same values for each RGB channel.
  
  Then, can I reduce the number of weights in the filters?
  Because in this case, using three different n×n filters and adding them is same with using one n×n filter that is the summation of three filters.
  
  Does this logic hold on a trained network?
  I have a trained network for RGB image input, but it is too heavy to run in real time.
  But I only use the greyscale images as input, so it seems I can make the network less heavy (theoretically, almost 1/3 of original).
  
  I'm quite new in this field, so detailed explanations will be really appreciated.
  Thank you.
  
  **Tags:** deep-learning, convolutional-neural-networks, signal-processing
  > **Comments:**
  > **username_0**: Yes, right. And it's impossible to retrain because I don't have training set...  
  > **username_1**: Sum up : No you don't reduce your number of weights by 3, you reduce your first layer number of weights by 3 only !  
  > **username_1**: @Jun Then maybe you should stay with the former CNN model. Or maybe try to reduce the number of weights, but it's not obvious that the network works better....  
  > **username_2**: Unless you have some very unusual images (e.g mostly one colour) then this is a very bad way to improve inference performance as anything you do will badly affect accuracy. If you don't have access to training data to retrain a network you should look into other routes (e.g TensorRT or better hardware) to improve inference performance.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-09-13. Score: 2
  
  > After inner product, add them all to make one feature map. Am I right?
  
  **yes**, you are right.
  
  > Then, can I reduce the number of weights in the filters? Because in this case, using three different n×n filters and adding them is same with using one n×n filter that is the summation of three filters.
  
  If you have transformed the image into greyscale then you no longer need 3 filters. You should retrain your model on greyscale images. In a greyscale image the value of each pixel is a single sample representing only an amount of light (the light intensity).
  
  The network will run faster if that is the only architectural change you make, but keep in mind that by converting the image to greyscale you will lose information and probably some of the predictive power of your network.
  
  > **Comments:**
  > **username_0**: Thanks for your comment. So greyscale image is the one-channel image, right? But I can't retrain it because I don't have training samples. What if I use RGB image with same values for each channel? It would be same with one channel grey scale image.  
  > **username_2**: No. It will almost certainly work badly. Each of the three RGB channels contains information about the light intensity for each of those colours. You may get some results by selecting a channel and its filter (e.g using only the red channel and filter for each image) and upscaling the weights, but this will certainly badly reduce the accuracy of your network. Also, if you have many hidden layers the performance improvement will be very small since the amount of computation after the first CNN layer will be exactly the same.  
  > **username_1**: Colour is very important to classify images. Imagine fruit for example, which rely a lot of the color of the object.  
  
  ---
  
  