'Deep learning image detection - Need help interpreting loss graph for training/validation

I have a deep learning image detection model that has produced the following loss graph (blue training red validation). I know the epochs are too low, but what the heck does this graph mean when the training line all of a sudden goes high while the validation is low? Data is from OpenImage of 6 classes and incredibly imbalanced (i.e of the approx 10,000 images in train, one class has 6000 images and another 34), so model was overfitted. Just implemented weight assignment. Use data augmentation. Using PyVision. Using 4 pretrained models and after retraining them will implement ensemble, if it produces better results. This is the result after training 4 epochs on one model.

train/validation loss graph

What does this graph mean please and how can I better interpret this myself in the future?

Also, I have been using low epochs to just make sure things are working. How should I determine the proper amount of epochs to train this model? Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source