Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

How to add weights to different loss components?

Open maksimovkonstantin opened this issue 7 years ago • 5 comments

Hi @waleedka !

Thanks for the great implementation of mask rcnn.

I have a little question - what is the shortest way to add weighting to different components of the loss? I want to give a bigger weight for class loss.

maksimovkonstantin avatar Aug 08 '18 16:08 maksimovkonstantin

Hi, you can add this in your config

    LOSS_WEIGHTS = {
        "rpn_class_loss": 1.,
        "rpn_bbox_loss": 1.,
        "mrcnn_class_loss": 1.,
        "mrcnn_bbox_loss": 1.,
        "mrcnn_mask_loss": 1.
    }

The default is all 1's.

VinniaKemala avatar Aug 09 '18 13:08 VinniaKemala

@VinniaKemala thanks, I think I need to merge my changes with current master, because I have older version

maksimovkonstantin avatar Aug 09 '18 13:08 maksimovkonstantin

@VinniaKemala @waleedka @maksimovkonstantin @moorage @PavlosMelissinos Hi everyone, I have change the values in the LOSS_weights dictionary of config file but still when I am loading the config details it is showing the default weights(1. for each loss), can someone tell me what more changes should be done to get custom loss weights. Screenshot (10)

Kartiky246 avatar Jan 26 '22 10:01 Kartiky246

What types of weights are possible? 10, 100, or is it just between 0 and 1? Thanks

OguntolaIbrahim avatar Jun 02 '22 06:06 OguntolaIbrahim

When creating a customConfig class, maybe you can just paste the weights therein to override the default

OguntolaIbrahim avatar Jun 02 '22 06:06 OguntolaIbrahim