prachigarg23 / MDIL-SS

Code repository for the work "Multi-Domain Incremental Learning for Semantic Segmentation", accepted at WACV 2022
52 stars 5 forks source link

About weight_IDD/BDD/city #4

Closed daeunni closed 1 year ago

daeunni commented 1 year ago

Hi, @prachigarg23 Thanks for your nice work! However, how did you calculate weight_IDD, weight_BDD, weight_city in your code like below?

Where can I earn these weights? (I want to change ERFNet to other segmentation models)

    weight_IDD = torch.tensor([3.235635601598852, 6.76221624390441, 9.458242359884549, 9.446818215454014, 9.947040673126763, 9.789672819856547, 9.476665808564432, 10.465565126694731, 9.59189547383129,
                               7.637805282159825, 8.990899026692638, 9.26222234098628, 10.265657138809514, 9.386517631614392, 8.357391489170013, 9.910382864314824, 10.389977663948363, 8.997422571963602,
                               10.418070541191673, 10.483262606962834, 9.511436923349441, 7.597725385711079, 6.1734896019878205, 9.787631041755187, 3.9178330193378708, 4.417448652936843, 10.313160683418731])

    weight_BDD = torch.tensor([3.6525147483016243, 8.799815287822142, 4.781908267406055, 10.034828238618045, 9.5567865464289, 9.645099012085169, 10.315292989325766, 10.163473632969513, 4.791692009441432,
                               9.556915153488912, 4.142994047786311, 10.246903827488143, 10.47145010979545, 6.006704177894196, 9.60620532303246, 9.964959813857726, 10.478333987902301, 10.468010534454706,
                               10.440929141422366, 3.960822533003462])

    weight_city = torch.tensor([2.8159904084894922, 6.9874672455551075, 3.7901719017455604, 9.94305485286704, 9.77037625072462, 9.511470001589007, 10.310780572569994, 10.025305236316246, 4.6341256102158805,
                                9.561389195953845, 7.869695292372276, 9.518873463871952, 10.374050047877898, 6.662394711556909, 10.26054487392723, 10.28786101490449, 10.289883605859952, 10.405463349170795,
                                10.138502340710136, 5.131658171724055])
prachigarg23 commented 1 year ago

Hi @daeunni , thanks.

Here is the file I used to compute class weights for the different datasets. You can also refer to the class weights computation in the original ERFNet repository here. From what I remember, segmentation uses a weighted loss computed by the frequency of classes in training data (especially if your segmentation data is severely imbalanced).