Open xiaoheizi123 opened 6 years ago
I get the file focal_loss.py under the operator_py ,and add the context in symbol file,in the function get_symbol_rfcn() such as following: if cfg.TRAIN.ENABLE_FOCAL_LOSS: 458 cls_prob = mx.sym.Custom(op_type = 'FocalLoss',name = 'cls_prob',data = cls_score,alpha = 0.25,gamma=2, 459 cls_score=cls_score, bbox_pred=bbox_pred, labels=label, 460 bbox_targets=bbox_target, bbox_weights=bbox_weight) 461 bbox_loss_ = bbox_weight * mx.sym.smooth_l1(name='bbox_loss_', scalar=2.0, data=(bbox_pred - bbox_target)) 462 bbox_loss = mx.sym.MakeLoss(name='bbox_loss', data=bbox_loss_, grad_scale=1.0 / cfg.TRAIN.BATCH_ROIS_FOCAL_LOSS) 463 label = labels ,but I get the error experiments/rfcn/../../rfcn/../lib/bbox/bbox_transform.py:129: RuntimeWarning: overflow encountered in exp pred_w = np.exp(dw) * widths[:, np.newaxis] experiments/rfcn/../../rfcn/../lib/bbox/bbox_transform.py:130: RuntimeWarning: overflow encountered in exp pred_h = np.exp(dh) * heights[:, np.newaxis] Epoch[0] Batch [100] Speed: 12.93 samples/sec Train-RPNAcc=0.856513, RPNLogLoss=0.000257, RPNL1Loss=12776018.528416, RCNNAcc=0.871269, RCNNLogLoss=nan, RCNNL1Loss=nan, Epoch[0] Batch [200] Speed: 12.80 samples/sec Train-RPNAcc=0.870054, RPNLogLoss=0.000180, RPNL1Loss=6419790.438247, RCNNAcc=0.870754, RCNNLogLoss=nan, RCNNL1Loss=nan, Epoch[0] Batch [300] Speed: 12.76 samples/sec Train-RPNAcc=0.873430, RPNLogLoss=0.000149, RPNL1Loss=4286969.716520, RCNNAcc=0.867086, RCNNLogLoss=nan, RCNNL1Loss=nan, Epoch[0] Batch [400] Speed: 12.66 samples/sec Train-RPNAcc=0.875658, RPNLogLoss=0.000133, RPNL1Loss=3217899.976960, RCNNAcc=0.863909,
if cfg.TRAIN.ENABLE_FOCAL_LOSS: 458 cls_prob = mx.sym.Custom(op_type = 'FocalLoss',name = 'cls_prob',data = cls_score,alpha = 0.25,gamma=2, 459 cls_score=cls_score, bbox_pred=bbox_pred, labels=label, 460 bbox_targets=bbox_target, bbox_weights=bbox_weight) 461 bbox_loss_ = bbox_weight * mx.sym.smooth_l1(name='bbox_loss_', scalar=2.0, data=(bbox_pred - bbox_target)) 462 bbox_loss = mx.sym.MakeLoss(name='bbox_loss', data=bbox_loss_, grad_scale=1.0 / cfg.TRAIN.BATCH_ROIS_FOCAL_LOSS) 463 label = labels
experiments/rfcn/../../rfcn/../lib/bbox/bbox_transform.py:129: RuntimeWarning: overflow encountered in exp pred_w = np.exp(dw) * widths[:, np.newaxis] experiments/rfcn/../../rfcn/../lib/bbox/bbox_transform.py:130: RuntimeWarning: overflow encountered in exp pred_h = np.exp(dh) * heights[:, np.newaxis] Epoch[0] Batch [100] Speed: 12.93 samples/sec Train-RPNAcc=0.856513, RPNLogLoss=0.000257, RPNL1Loss=12776018.528416, RCNNAcc=0.871269, RCNNLogLoss=nan, RCNNL1Loss=nan, Epoch[0] Batch [200] Speed: 12.80 samples/sec Train-RPNAcc=0.870054, RPNLogLoss=0.000180, RPNL1Loss=6419790.438247, RCNNAcc=0.870754, RCNNLogLoss=nan, RCNNL1Loss=nan, Epoch[0] Batch [300] Speed: 12.76 samples/sec Train-RPNAcc=0.873430, RPNLogLoss=0.000149, RPNL1Loss=4286969.716520, RCNNAcc=0.867086, RCNNLogLoss=nan, RCNNL1Loss=nan, Epoch[0] Batch [400] Speed: 12.66 samples/sec Train-RPNAcc=0.875658, RPNLogLoss=0.000133, RPNL1Loss=3217899.976960, RCNNAcc=0.863909,
what did I do wrong?
I get the file focal_loss.py under the operator_py ,and add the context in symbol file,in the function get_symbol_rfcn() such as following:
if cfg.TRAIN.ENABLE_FOCAL_LOSS: 458 cls_prob = mx.sym.Custom(op_type = 'FocalLoss',name = 'cls_prob',data = cls_score,alpha = 0.25,gamma=2, 459 cls_score=cls_score, bbox_pred=bbox_pred, labels=label, 460 bbox_targets=bbox_target, bbox_weights=bbox_weight) 461 bbox_loss_ = bbox_weight * mx.sym.smooth_l1(name='bbox_loss_', scalar=2.0, data=(bbox_pred - bbox_target)) 462 bbox_loss = mx.sym.MakeLoss(name='bbox_loss', data=bbox_loss_, grad_scale=1.0 / cfg.TRAIN.BATCH_ROIS_FOCAL_LOSS) 463 label = labels
,but I get the errorexperiments/rfcn/../../rfcn/../lib/bbox/bbox_transform.py:129: RuntimeWarning: overflow encountered in exp pred_w = np.exp(dw) * widths[:, np.newaxis] experiments/rfcn/../../rfcn/../lib/bbox/bbox_transform.py:130: RuntimeWarning: overflow encountered in exp pred_h = np.exp(dh) * heights[:, np.newaxis] Epoch[0] Batch [100] Speed: 12.93 samples/sec Train-RPNAcc=0.856513, RPNLogLoss=0.000257, RPNL1Loss=12776018.528416, RCNNAcc=0.871269, RCNNLogLoss=nan, RCNNL1Loss=nan, Epoch[0] Batch [200] Speed: 12.80 samples/sec Train-RPNAcc=0.870054, RPNLogLoss=0.000180, RPNL1Loss=6419790.438247, RCNNAcc=0.870754, RCNNLogLoss=nan, RCNNL1Loss=nan, Epoch[0] Batch [300] Speed: 12.76 samples/sec Train-RPNAcc=0.873430, RPNLogLoss=0.000149, RPNL1Loss=4286969.716520, RCNNAcc=0.867086, RCNNLogLoss=nan, RCNNL1Loss=nan, Epoch[0] Batch [400] Speed: 12.66 samples/sec Train-RPNAcc=0.875658, RPNLogLoss=0.000133, RPNL1Loss=3217899.976960, RCNNAcc=0.863909,
what did I do wrong?