Issue
I created a UNET that is using a fit_generator with validation_data, like this:
model.fit_generator(train_gen,
validation_data=valid_gen,
steps_per_epoch=train_steps,
validation_steps=valid_steps,
epochs=epochs)
And I was wondering: during the different Epochs, does the keras model also learns when running the validation data? I suspect it doesn't, after all if it did, val_acc wouldn't be a valuable performance metric over several epochs. But I couldn't find a confirmation of my guess anywhere. Thoughts?
Other details: As one would expect, valid_gen and train_gen in my code are created with different sets of data, previously defined by splitting the database:
train_gen = DataGen(train_list, path_general, image_size=image_size, batch_size=batch_size)
valid_gen = DataGen(valid_list, path_general, batch_size=batch_size, image_size=image_size)
Solution
You are correct. Validation data is only ran forward through the model (i.e., no backpropagation) at the end of each epoch to assess generalization performance of the model. It is exactly as you said, if the model learned from the validation data it would completely undermine its validity to test for generalization.
Answered By - ATony
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.