Answers.Body: <p>In addition to the first answer about feature selection, you could also add a global max or average pooling layer at the end of your network. This would reduce the dimensionality to 512 or 1024. If that's still too much, another option would be to add an additional convolutional layer with reduced channels and then do the global pooling. You will have to experiment with which option is best for your data.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-20T20:58:10.597Z
Answers.LastActivityDate: 2021-04-20T20:58:10.597Z
Answers.UserDisplayName: Mike NZ
Answers.Body: <p>I think it's okay to let CNN extract a big number of feature maps, then you can reduce the features from it. To reduce features from CNN result, you can do feature selection or feature extraction. Some people prefer to use feature selection and select the most significant feature maps, for examples:</p>
  
  <ul>
  <li><a href="https://ieeexplore.ieee.org/document/7966100" rel="nofollow noreferrer">Action unit selective feature maps in deep networks for facial expression recognition</a></li>
  <li><a href="https://ieeexplore.ieee.org/document/7823876" rel="nofollow noreferrer">Convolutional Neural Network Simplification Based on Feature Maps Selection</a></li>
  </ul>
  
  <p>Hope it helps.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-02T06:50:45.177Z
Answers.LastActivityDate: 2018-11-02T06:50:45.177Z
Answers.UserDisplayName: malioboro
Body: <p>I have trained a convolutional neural network on images to detect emotions. Now I need to use the same network to extract features from the images and use them to train an LSTM. The problem is: the dimensions of the top layers are: <code>[None, 4, 4, 512]</code> or <code>[None, 4, 4, 1024]</code>. Therefore, extracting features from this layer will result in a <code>4 x 4 x 512 = 8192</code> or <code>4 x 4 x 1024 = 16384</code> dimensional vector for each image. Clearly, this is not what I want.</p>
  <p>Therefore, I would like to know what to do in this case and how to extract features that are of reasonable size. Should I apply global average pooling to the activation or what?</p>
  <p>Any help is much appreciated!</p>
  
Tags: <convolutional-neural-networks><long-short-term-memory><feature-selection><dimensionality>
Title: Problem extracting features from convolutional layer where the dimensions are big for feature maps
UserDisplayName: I. A
ThreadText: # Problem extracting features from convolutional layer where the dimensions are big for feature maps
  
  (Asked by: username_0 on 2018-11-01)
  
  I have trained a convolutional neural network on images to detect emotions. Now I need to use the same network to extract features from the images and use them to train an LSTM. The problem is: the dimensions of the top layers are: `[None, 4, 4, 512]` or `[None, 4, 4, 1024]`. Therefore, extracting features from this layer will result in a `4 x 4 x 512 = 8192` or `4 x 4 x 1024 = 16384` dimensional vector for each image. Clearly, this is not what I want.
  
  Therefore, I would like to know what to do in this case and how to extract features that are of reasonable size. Should I apply global average pooling to the activation or what?
  
  Any help is much appreciated!
  
  **Tags:** convolutional-neural-networks, long-short-term-memory, feature-selection, dimensionality
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-04-20. Score: 0
  
  In addition to the first answer about feature selection, you could also add a global max or average pooling layer at the end of your network. This would reduce the dimensionality to 512 or 1024. If that's still too much, another option would be to add an additional convolutional layer with reduced channels and then do the global pooling. You will have to experiment with which option is best for your data.
  
  
  ---
  
  ### Answer by username_2 on 2018-11-02. Score: 0
  
  I think it's okay to let CNN extract a big number of feature maps, then you can reduce the features from it. To reduce features from CNN result, you can do feature selection or feature extraction. Some people prefer to use feature selection and select the most significant feature maps, for examples:
  
  * [Action unit selective feature maps in deep networks for facial expression recognition](https://ieeexplore.ieee.org/document/7966100)
  * [Convolutional Neural Network Simplification Based on Feature Maps Selection](https://ieeexplore.ieee.org/document/7823876)
  
  Hope it helps.
  
  
  ---
  
  