Answers.Body: <p>Ok, I solved this problem
  The simple thing was that learning rate was too big
  I changed the code to this</p>
  <pre><code>LR = batch_size/((z+1)*100000)
  LR=LR/3
  </code></pre>
  <p>instead of</p>
  <pre><code>LR = batch_size/((z+1)*1000)
  LR=LR/3
  </code></pre>
  <p>and it seems to work well</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-31T15:55:13.453Z
Answers.Text: The question still remains that why does it show decent accuracy in case of training and not in validation when the learning rate is too high
Answers.UserDisplayName: Sadaf Shafi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-31T15:54:20.023Z
Answers.LastActivityDate: 2021-03-31T15:54:20.023Z
Answers.UserDisplayName: Sadaf Shafi
Body: <p>I posted this question on <a href="https://stackoverflow.com/questions/66503501/validation-accuracy-remains-constant-while-training-vgg">stackoverflow</a> and got downvoted for unmentioned reason, so I'll repost it here, hoping to get some insights</p>
  <p>This is the plot
  <a href="https://i.sstatic.net/dHIWQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dHIWQ.png" alt="enter image description here" /></a></p>
  <p>This is the code:</p>
  <pre><code>with strategy.scope():
  
    model2 = tf.keras.applications.VGG16(
      include_top=True,
      weights=None,
      input_tensor=None,
      input_shape=(32, 32, 3),
      pooling=None,
      classes=10,
      classifier_activation=&quot;relu&quot;,
    )
  
    model2.compile(optimizer='adam',
                  loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
                  metrics=['accuracy'])
    
    history = model2.fit(
              train_images, train_labels,epochs=10, 
              validation_data=(test_images, test_labels)
              )
  </code></pre>
  <p>I'm trying to train VGG16 from scratch, hence not importing their weights I also tried a model which I created myself, with same hyperparameters, and that worked fine</p>
  <p>Any help is highly appreciated</p>
  <p><a href="https://gist.github.com/SadafShafi/d55d20df6c2f7586bf211476fedee950" rel="nofollow noreferrer">Heres</a> the full code</p>
  
Tags: <neural-networks><deep-learning><tensorflow>
Title: Validation Accuracy remains constant while training VGG?
UserDisplayName: Sadaf Shafi
ThreadText: # Validation Accuracy remains constant while training VGG?
  
  (Asked by: username_0 on 2021-03-13)
  
  I posted this question on stackoverflow and got downvoted for unmentioned reason, so I'll repost it here, hoping to get some insights
  This is the plot
  
  This is the code:
  with strategy.scope():
  
    model2 = tf.keras.applications.VGG16(
      include_top=True,
      weights=None,
      input_tensor=None,
      input_shape=(32, 32, 3),
      pooling=None,
      classes=10,
      classifier_activation="relu",
    )
  
    model2.compile(optimizer='adam',
                  loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
                  metrics=['accuracy'])
    
    history = model2.fit(
              train_images, train_labels,epochs=10, 
              validation_data=(test_images, test_labels)
              )
  
  I'm trying to train VGG16 from scratch, hence not importing their weights I also tried a model which I created myself, with same hyperparameters, and that worked fine
  Any help is highly appreciated
  Heres the full code
  
  **Tags:** neural-networks, deep-learning, tensorflow
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-03-31. Score: 0 | Accepted answer
  
  Ok, I solved this problem
  The simple thing was that learning rate was too big
  I changed the code to this
  LR = batch_size/((z+1)*100000)
  LR=LR/3
  
  instead of
  LR = batch_size/((z+1)*1000)
  LR=LR/3
  
  and it seems to work well
  
  > **Comments:**
  > **username_0**: The question still remains that why does it show decent accuracy in case of training and not in validation when the learning rate is too high  
  
  ---
  
  