I am experimenting with tensorflow object detection code with Faster RCNN architecture and because of high class imbalance in dataset, I was trying to modify loss to weighted loss (based on fraction of different class images). But there is already a weight with softmax loss in code, most probably to handle class imbalance between positive example and background (negative). How can I modify this loss to also account for inter-class imbalance, not just between a class and background (non-class)?