# Loss Inspector

The loss inspector is a monitoring tool of the changes in the validation loss during training for High Detail modes (Green Classify High Detail mode and Red Analyze High Detail mode). From VisionPro Deep Learning 1.1, you can inspect the change of validation loss while training or for an already trained High Detail Mode tool.

The loss inspector gives you more control in training a High Detail Mode tool. By monitoring the validation loss, you can monitor the fluctuation and the saturation of the loss to get the best loss for the best model, and also see how your model generalizes well and thus can check how much it is overfitted as this loss is from the validation set.

CAUTION: The loss inspector does not provide the graph of validation loss of a High Detail tool trained in the earlier version of VisionPro Deep Learning 1.1. For example, if you imported a Green Classify High Detail Mode tool trained in VisionPro Deep Learning 1.0, the loss inspector does not provide its loss graph. But, if you re-train this tool in 1.1 or 2.0, the loss inspector shows its loss from this new training session.
Note: For details of the Red Analyze High Detail validation loss, see Validation Set and Validation Loss
Note: For details of the Green Classify High Detail validation loss, see Validation Set and Validation Loss

## How to Use Loss Inspector

Loss Inspector is only enabled after you load image data, set ROI, create a High Detail Mode tool, and train it.

1. Go to Tool – Inspect Loss while training a High Detail Mode tool or after the training.

   1. While training, you can click a graph icon on each tool to monitor validation loss in real-time.

2. You can notice Loss Inspector window pops up and can see the variations of validation loss along with epochs.

3. If you abort training before it is done, a pop-up shows up asking to save the current model or not. To look at the validation loss of the current model trained so far, you should save the model information.

   1. When you click "X" icon to stop training and click "Yes" button on the dialog that asks for saving tool information, you can later check the loss graph of the current training session until the point of aborting this training for this tool.

   2. When you click "X" icon to stop training and click "No" button on the dialog that asks for saving tool information, all the loss records of the current training session for this tool are gone and you can't check the loss graph of it. Then Loss Inspector only provides the loss graph of the last completed training session for this tool.

4. After the completion of the training, a red dot is marked on the graph to visualize the Best Epoch and the Best Loss for this training session.

## Status Variables

Variable | Description
--- | ---
Elapsed Time | The elapsed time for the current training.
Elapsed Epoch | The elapsed epoch for the current training.
Loss | The validation loss of the trained model at Elapsed Epoch. Loss is calculated in every 0.125 epoch.
Best Epoch | The epoch that recorded the lowest loss through all the elapsed epochs.
Best Loss | The lowest loss through all the elapsed epochs.

The Best Epoch can be updated while the Loss is not changing at all. When the Loss is not reduced as epochs go by, the loss inspector picks an epoch among the ones with the same Losses by an internal metric, and then the chosen epoch becomes the Best Epoch. The table below is an example of the status that you can actually bump into when using the loss inspector.

Elapsed Epoch | Loss | Best Epoch
3 | 0.2 | 3
4 | 0.2 | 3
51 This epoch was chosen to be the Best Epoch among 3, 4, and 5, by the internal metric. The metric selects an epoch to provide the optimal results. | 0.2 | 5
6 | 0.2 | 5
7 | 0.2 | 7

## Zoom & Pan

You can zoom in/out, zoom in a specific rectangular region, or pan on the loss graph area by enabling Zoom/Pan checkbox: