Hey thanks!
I did the following weighing which gave me pretty good results:
nSamples = [887, 6130, 480, 317, 972, 101, 128]
normedWeights = [1 - (x / sum(nSamples)) for x in nSamples]
normedWeights = torch.FloatTensor(normedWeights).to(device)

Yes you are right

the more instance the less weight of a class

I will also try the way you’ve mentioned.
And are there ways to optimize weights?
Thanks again!