You could store the loss and accuracy in a list as scalar values via e.g.:
losses.append(loss.detach().cpu().item())

and use matplotlib.pyplot.plot to visualize the loss and accuracy curves.



 imran:

Second problem is that after fine tuning I get a lot of masks. The only valid masks are the top The number of persons in image. All other masks are errors. How can I identify the total valid masks.


You could probably just index the first masks given the number of people. I’m not sure I understand the problem correctly, so could you explain the issue a bit more?