TimoSaemann / ENet

ENet: A Deep Neural Network Architecture for Real-Time Semantic Segmentation
577 stars 276 forks source link

About the calculate_class_weighting.py #49

Open sunpeng1996 opened 6 years ago

sunpeng1996 commented 6 years ago

hi, I use the calculate_class_weighting.py generare the loss weight for my training. and I find some problems.

First, the weight is: 0.0819 0.4754 0.1324 1.5224 1.5190 2.4730 8.1865 5.2286 0.1870 1.4695 0.6893 1.9814 7.8091 0.4164 1.3809 1.1982 0.6273 5.3535 4.0939 ,the distrubution is too large.

Second, I use the weight for loss to train, And the Mean IOU drop 7%. Could you give me some tricks and help? thx a lot!

sunpeng1996 commented 6 years ago

@TimoSaemann

ewen1024 commented 6 years ago

@sunpeng1996
1.While the weights is calculated from the statistics, you can't blame the distribution is too large when the distribution IS large.

2.Though my code has performance boost after the weighs, I do know that doesn't guarantee the IOU Increase. The author said in the tutorial that if you want to keep the small class, then use the weights. You can imagine if one class is 1% of class 2. Than the class 1 is easily overwhelmed by class 2, especially at the edges of these 2 classes. So you give weighs to keep the pixel in class 1. But that was not the solver wanted to be, cause the original possibility is what he wants after optimizing the loss.

So evaluate your image, if the small class has good performance, than it's ok. If not, check your optimizing procedure, like epoch learning rate dropout...

Hope it helps.