Dynamic Weighted Cross Entropy for Semantic Segmentation with Extremely Imbalanced Data
Sheng Fu Lu, Feng Gao, Changhao Piao, Ying Ma · 2019
The most common loss function in semantic segmentation is the cross entropy. In the most data-balanced scene, the cross entropy can be used as a loss function to achieve good results. However, in the real scene, there are many cases where the data are extremely imbalanced. In these cases, it is difficult to obtain ideal results by using the cross entropy as the loss function. In order to solve the aforementioned problem, we propose a dynamic weighted cross entropy as the loss function for semantic segmentation. Firstly, we count the number of each category in each training batch and global data. And then a weighting method is designed to weight the cross entropy. The object which is extremely hard to classify is removed by the hard truncation. Finally, we iterate the weight in every train step. The experiment results demonstrate that our method can effectively improve the segmentation accuracy with extremely imbalanced data.