Exercise

Writing the evaluation loop

In this exercise, you will practice writing the evaluation loop. The evaluation loop is similar to the training loop, except that you will not perform the gradient calculation and the optimizer step.

The model used has already been trained on the facemask dataset and the code will display some sample images and their corresponding losses using the plot_results function.

For each sample, the ground truth label is indicated as GT and the model prediction as PRED.

Instructions 1/2

undefined XP
    1
    2
  • Set the model to evaluation mode.
  • Sum the current batch loss to the validation_loss variable.