I am solving a multi-class image segmentation problem.
Classes are imbalanced.
I am trying to calibrate weight parameter of nn.Cross_entropy() using the below weight -
weights = torch.tensor([0.90,0.40,0.40,0.20])
criterion = torch.nn.CrossEntropyLoss(weights)

Above number , I used were arbitrary.
On calculating number of different classes in a single image, following it the result -
(tensor([0, 1, 2, 3]), tensor([305903,  12655,  10342,   1060]))
Generally, the above values will vary for each image but class 0 will remain in abundance(it is background), class 1 and class 2 in moderation( desired segmented classes), class 3 will be very less( it is for unknown cases.
How to choose weights values for it?