mx-maskrcnn icon indicating copy to clipboard operation
mx-maskrcnn copied to clipboard

Custom Loss function and End-to-End training

Open tkuanlun350 opened this issue 8 years ago • 3 comments

Hi ! I apologize that the first question may seemed stupid :( because I am not very familiar with mxnet yet.

I want to use my custom loss function, and what I do is change metric.py first to see the loss value is consistent with my calculation instead of changing the gradient (PY_OP) directly. But I found that the training is actually affected ! The Loss value converge much slower. Isn't mxnet metric is only used for analyze ? (print out loss value...etc)

I've write a periodic evaluation script changed from original eval script and realize that my dataset doesn't need so much epoch to converge and may even work with end-to-end training. The original faster-RCNN mxnet implementation experienced performance boost from end-to-end training therefore I want to ask that if you ever tried to do end-to-end training ? I know the paper said that they trained rpn and maskrcnn separately, but I think that is because they want to make fair comparison with detection backbone ?

If end-to-end make sense, I will tried to make it work and happy to send a PR. Thanks !

tkuanlun350 avatar Nov 18 '17 05:11 tkuanlun350

Hi, @tkuanlun350 Yes, metric is only used for analyze.

We do use e2e at first, with a simplified FPN backbone(treat every FPN level imdependently), but the result is bad. There are two main difficulties in implement the e2e training. The first one is the backward part of the fpn_roi_pooling operator. The second is generate mask target(28*28 mask label) on the fly. In alternated training, the above difficulties could be avoided, and this is what we do in our code.

Nothing is more exciting than a PR. I'm very happy to help.

Zehaos avatar Nov 18 '17 05:11 Zehaos

@tkuanlun350 I want to know whether you have get end-to-end training worked? If you have get it done, can you release you scripts?

wenhe-jia avatar Dec 28 '17 13:12 wenhe-jia

@LeonJWH @tkuanlun350 Thanks for your code, can you tell me how to change the loss? I double check the code again and again, I just modify the metric.py in rcnn folder. Is it right?

xuhuaren avatar Feb 02 '18 21:02 xuhuaren