Hi, I am trying to deal with the class imbalance problem in image segmentation.
And as my target mask size is 128x128. If I have 3300 training image, my total number of target data (if concatenated ) will be 422400 x 128.
I tried to get the total_mask which has the size torch.Size([422400, 128])
And I try to build the sampler with this code below.
unique_color, count = np.unique(mask_total.cpu(), return_counts = True)
weight = 1. / count
samples_weight = weight[mask_total]

It give me this error
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

since my mask_total is 422400 x 128.
So if my images are 128 x128, to get the samples_weight,  what should I implement?
Thank you a lot.