facebookresearch / Detectron

FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.
Apache License 2.0
26.24k stars 5.45k forks source link

How can I use softmax loss to train retinanet? #703

Open mytxgmy opened 5 years ago

mytxgmy commented 5 years ago

I'd like to use SoftmaxWithLoss instead of SoftmaxFocalLoss. gated_prob, cls_focal_loss = model.net.SoftmaxWithLoss( [cls_lvl_logits, 'retnet_cls_labels_' + suffix], ['retnet_prob_{}'.format(suffix), 'fl_{}'.format(suffix)], scale=model.GetLossScale() ) input: "gpu_7/retnet_cls_pred_fpn6" input: "gpu_7/retnet_cls_labels_fpn6" output: "gpu_7/retnet_prob_fpn6" output: "gpu_7/fl_fpn6" name: "" type: "SoftmaxWithLoss" arg { name: "scale" f: 0.125 } device_option { device_type: 1 cuda_gpu_id: 7 }

mytxgmy commented 5 years ago

If I set LOSS_GAMMA=0.0 and LOSS_ALPHA=1.0 json_stats: {"eta": "1 day, 19:20:23", "fl_fpn3": 0.000000, "fl_fpn4": 0.000000, "fl_fpn5": 0.000000, "fl_fpn6": 0.000000, "fl_fpn7": 0.000000, "iter": 20, "loss": 0.467662, "lr": 0.003600, "mb_qsize": 1, "mem": 5689, "retnet_bg_num": 2225012.812500, "retnet_fg_num": 446.937500, "retnet_loss_bbox_fpn3": 0.149183, "retnet_loss_bbox_fpn4": 0.186300, "retnet_loss_bbox_fpn5": 0.106248, "retnet_loss_bbox_fpn6": 0.029688, "retnet_loss_bbox_fpn7": 0.000482, "time": 1.733985}