Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

mrcnn_class_loss() keeps fluctuating

Open ErinYang96 opened this issue 2 years ago • 5 comments

Hi all,

I am currently using the Mask_RCNN Model for a object tracking project. I have completed the training process successfully, with the loss functions displayed below (read from the event file). trout20220628T1753_sum Note that I set epochs for head layer as 80 (first stage), and epochs for fine tuning all layers as 160 (second stage).

My questions are:

  1. Why the event file only shows 80 epochs, and the tensorboard can read as far as 160 epochs?
  2. How to evaluate my training results from this graph? (loss stabilizes at about1.0, and mrcnn_class_loss keeps fluctuating) Note that I have only one class in my project.
  3. Based on Q2, how can I improve my model (from dataset or hyperparameter setup)?

I proposed a similar issue here. I have checked this link to understand the learning curve, and this link to learn about hyperparameters. Hope my info can help you deal with the problem.

If you have any ideas, please don't hesitate to comment below. Many thanks in advance for your kind support.

Best,

Erin

ErinYang96 avatar Jul 03 '22 19:07 ErinYang96

Hi all, I have tried to combine the two event files together, and the results are the same as tensorboard has shown, which means Q1 is solved. However, I still need your advice on how to improve the model (mainly about the mrcnn_class_loss()).

ErinYang96 avatar Jul 04 '22 18:07 ErinYang96

Hi,

have you tried to increase the loss_weights?

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

Testbild avatar Jul 14 '22 08:07 Testbild

@Testbild Do you mean that I could try to increase the default loss weights? Why do you think this may work for me? Could you provide more info to explain the principles? Thanks.

ErinYang96 avatar Jul 14 '22 13:07 ErinYang96

The weight to my understanding increases the importance of the loss for your problem. Hence if this is important to you and you want to "punish" the model more for making mistakes in this regard you increase the weight. So that instead of contributing with a factor of 1 to the loss with a factor of 2 or 3.

Maybe just increase the respective loss weight to 2 or 3 and compare the results.

Testbild avatar Jul 14 '22 17:07 Testbild

@Testbild Okay, this sounds reasonable. I will try it and let you know if I have further proceedings in improving the model performance. Thanks for your kind suggestions!

ErinYang96 avatar Jul 15 '22 07:07 ErinYang96

I'm trying to look at each loss too. But I haven't figured out the way to do it. Could you please show me the way?

sabrina19950113 avatar Jan 11 '23 01:01 sabrina19950113