Borrar filtros
Borrar filtros

How to calculated training and validation loss in Yolov4

9 visualizaciones (últimos 30 días)
Alexey Kozhakin
Alexey Kozhakin el 26 de Nov. de 2022
Respondida: Aneela el 27 de Mzo. de 2024
I run training yolov4 model. Size of training dataset 1024 images, validation dataset is 256 images. Batch size 32. On first iteration Training loss is around 383 and Validation loss is around 30. Question is, who is calculated training and validation loss? For trainings loss, is it everage loss of 1024 images training dataset? or common loss of 1024 images? And the same question about validation loss. And why at 1st itereration validation loss less then training loss?
  3 comentarios
Alexey Kozhakin
Alexey Kozhakin el 27 de Nov. de 2022
sorry, I completly don't understand what you mean. I need to know how calculate in matlab Training loss and Validation loss in Yolov4 in Matlab and why on first iteration Validation loss less then Training loss
Alexey Kozhakin
Alexey Kozhakin el 3 de Dic. de 2022
Editada: Alexey Kozhakin el 3 de Dic. de 2022
On which iteration I should stop training?

Iniciar sesión para comentar.

Respuestas (1)

Aneela
Aneela el 27 de Mzo. de 2024
Hi Alexey Kozhakin,
As you have mentioned that the training dataset is having 1024 images validation dataset is having 256 images and the batch size is 32, there are 32 batches (1024/32) for training and 8 batches (256/32) for validation.
Training loss:
  • The training loss is calculated as the average loss over all batches in the training dataset during an epoch. In your case, 32 batches in a single epoch for training.
  • For each batch, the model makes predictions, and a loss function such as cross-entropy loss calculates the loss by comparing the predicted values to the actual values.
Validation loss:
  • The validation loss is calculated in a similar manner but is done on the validation dataset, which the model has not trained on.
  • Validation loss is also the average loss over all batches in the validation dataset during an epoch. In your case, 8 batches in a single epoch for validation.
Validation loss is less than the training loss may be because of the following reasons:
  • The initial weights to the layers are all randomly assigned, and it takes couple of epochs before you start to see meaningful training information.
  • Regularization or dropout added during training and not during the validation.
  • Incorrect splitting of training and validation data
For more information on “yolov4” refer to the following links:

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by