Any way to visualize image classification accuracy during training?

I saw many source code about image classification and I found that most people only visualize classification loss during training and only visualize accuracy during test phase.
why is this? how do I know when to stop training?


To be honest, Its up to you. You can print and visualize whatever you want during training/validation. You just need to add accuracy calculation after each epoch and visualize it with something like visdom or simply in a terminal.


for x, y_true in validation_loader:
    y_pred =[1] # output is a result of your model
    total_loss += loss.item()
    num_correct += y_pred.eq(y_true).long().sum().item()
average_loss = total_loss / len(validation_loader)
accuracy = num_correct / len(validation_loader.dataset) * 100

But you never know when you should stop training. There are different recommendations or regularization techniques (e.g., Early stopping), but there is no global solution. So, experiment your way :slight_smile:

1 Like