0
$\begingroup$

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 enter image description here

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

$\endgroup$
0

1 Answer 1

0
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ 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 $\endgroup$ Mar 31, 2021 at 15:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .