Search code examples
image-processingkerastensorflow2.0keras-layertensorflow-datasets

Val_loss is very high (over 100)


I'm trying to create a neural network for image classification. This is my Model summary. I have done normalization to my dataset and shuffling to my data. . When I run model.fit the val_loss is very high sometimes close to 100 whereas my loss is less than 0.8


Solution

  • When you don't normalize test data, validation loss will be very high when compared to training data that was normalized. I used simple mnist model to demonstrate the point of normalization.

    (x_train, y_train), (x_test, y_test) = mnist.load_data()
    # this is to demonstrate the importance of normalizing both training and testing data
    x_train, x_test = x_train / 255.0, x_test / 1.
    

    When we don't normalize test data where as training data was normalized, training loss is loss: 0.0771 where as loss during test is 13.1599. Please check the complete code here. Thanks!