Class weighting for FasterRCNN using Resnet50

I am using the pytorch Resnet50 backbone for a FasterRCNN model as a basis for fine-tuning an object detector. I have done some transfer training on an ultrasound dataset (800 images) with decent results for a two class system. When I do further training with a much larger dataset (18000 images) with 80% belonging to one class, I get a lot of false negatives. Is there a way to weight the smaller label set higher than the larger label set during training for FasterRCNN?

For imbalanced dataset can you try using RetinaNet? It uses focal loss and might handle such weight imbalances better.

https://pytorch.org/vision/stable/models/retinanet.html

Also see paper

As paper states

“Our novel Focal Loss focuses training on a sparse set of hard examples and prevents the vast number of easy negatives from overwhelming the detector during training. To evaluate the effectiveness of our loss, we design and train a simple dense detector we call RetinaNet. Our results show that when trained with the focal loss, RetinaNet is able to match the speed of previous one-stage detectors while surpassing the accuracy of all existing state-of-the-art two-stage detectors.”

This is just a try, cannot guarantee it would work better, but might just help.

1 Like