AndreaCodegoni / Tiny_model_4_CD

Official implementation of TinyCD: A (Not So) Deep Learning Model For Change Detection
113 stars 20 forks source link

Improvement with weighted loss #16

Open robmarkcole opened 1 year ago

robmarkcole commented 1 year ago

My own dataset is very imbalanced, and I achieved superior results using:

        weight_for_positive_class = 5
        pos_weight = torch.tensor([weight_for_positive_class])
        self.criterion = torch.nn.BCEWithLogitsLoss(pos_weight=pos_weight)
AndreaCodegoni commented 1 year ago

Hello Robin!

Thanks for pointing out! I have a curiosity: to find the weight did you use any type of optimization or make any inference starting from the dataset?

robmarkcole commented 1 year ago

@AndreaCodegoni nothing too flashy I tried a range 3,4,5,10,20