(bbox_pred, bbox_targets, sigma=1.0)
return loss_box
:param bbox_pred: [-1, 4] in RPN. [-1, cls_num+1, 4] in Fast-rcnn
    :param bbox_targets: shape is same as bbox_pred
    :param sigma:
    :return:
def _smooth_l1_loss_base(bbox_pred, bbox_targets, sigma=1.0):
    '''

    :param bbox_pred: [-1, 4] in RPN. [-1, cls_num+1, 4] in Fast-rcnn
    :param bbox_targets: shape is same as bbox_pred
    :param sigma:
    :return:
    '''
    sigma_2 = sigma**2

    box_diff = bbox_pred - bbox_targets

    abs_box_diff = tf.abs(box_diff)

    smoothL1_sign = tf.stop_gradient(
        tf.to_float(tf.less(abs_box_diff, 1. / sigma_2)))
    loss_box = tf.pow(box_diff, 2) * (sigma_2 / 2.0) * smoothL1_sign \
               + (abs_box_diff - (0.5 / sigma_2)) * (1.0 - smoothL1_sign)
    return loss_box
def _smooth_l1_loss_base ( bbox_pred , bbox_targets , sigma = 1.0 ) : sigma_2 = sigma ** 2 box_diff = bbox_pred - bbox_targets abs_box_diff = tf . abs ( box_diff ) smoothL1_sign = tf . stop_gradient ( tf . to_float ( tf . less ( abs_box_diff , 1. / sigma_2 ) ) ) loss_box = tf . pow ( box_diff , 2 ) * ( sigma_2 / 2.0 ) * smoothL1_sign + ( abs_box_diff - ( 0.5 / sigma_2 ) ) * ( 1.0 - smoothL1_sign ) return loss_box