Answers.Body: <p>Not only the units but also the number of layers... you can reason over something like &quot;how complex is your task&quot;, but usually we resort to grid search over some educated guesses (like 2/3 layer of 128/256 neurons, but depends)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-11-21T13:07:08.393Z
Answers.LastActivityDate: 2023-11-21T13:07:08.393Z
Answers.UserDisplayName: Alberto
Answers.Body: <p>In adition to @Alberto answer,
  Start by the same number of layer and units you removed from original model.
  If the problem is the same, this will be probably the best solution.
  After that, if the results is good enough, try reducing until results start fading, if result is not good, build up progressively.
  Rule of the thumb,
  More layer for more complicated task, more units for bigger number of inputs task.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-11-21T21:02:44.437Z
Answers.LastActivityDate: 2023-11-21T21:02:44.437Z
Answers.UserDisplayName: Jonathan Roy
Body: <p>I'm using MobileNetV2 for classification, and I want to add dense layers(i remove the last layer of the MobileNetV2 model). How do I choose the number of units for the dense layer after obtaining the feature vector (1280)? Is there a formula to determine the units for each dense layer I add?</p>
  
Tags: <machine-learning><deep-learning><feature-extraction><dense-layers><mobile-net-v2>
Title: how to determine the number of units for dense layer for transfer learning?
UserDisplayName: Cy Rine
ThreadText: # how to determine the number of units for dense layer for transfer learning?
  
  (Asked by: username_0 on 2023-11-21)
  
  I'm using MobileNetV2 for classification, and I want to add dense layers(i remove the last layer of the MobileNetV2 model). How do I choose the number of units for the dense layer after obtaining the feature vector (1280)? Is there a formula to determine the units for each dense layer I add?
  
  **Tags:** machine-learning, deep-learning, feature-extraction, dense-layers, mobile-net-v2
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2023-11-21. Score: 2
  
  Not only the units but also the number of layers... you can reason over something like "how complex is your task", but usually we resort to grid search over some educated guesses (like 2/3 layer of 128/256 neurons, but depends)
  
  
  ---
  
  ### Answer by username_2 on 2023-11-21. Score: 1
  
  In adition to @username_1 answer,
  Start by the same number of layer and units you removed from original model.
  If the problem is the same, this will be probably the best solution.
  After that, if the results is good enough, try reducing until results start fading, if result is not good, build up progressively.
  Rule of the thumb,
  More layer for more complicated task, more units for bigger number of inputs task.
  
  
  ---
  
  