(boxes, gt_boxes, weights=(1.0, 1.0, 1.0, 1.0))
return targets
Inverse transform that computes target bounding-box regression deltas
    given proposal boxes and ground-truth boxes. The weights argument should be
    a 4-tuple of multiplicative weights that are applied to the regression
    target.

    In older versions of this code (and in py-faster-rcnn), the weights were set
    such that the regression deltas would have unit standard deviation on the
    training dataset. Presently, rather than computing these statistics exactly,
    we use a fixed set of weights (10., 10., 5., 5.) by default. These are
    approximately the weights one would get from COCO using the previous unit
    stdev heuristic.
Inverse transform that computes target bounding-box regression deltas
    given proposal boxes and ground-truth boxes. The weights argument should be
    a 4-tuple of multiplicative weights that are applied to the regression
    target.
Inverse transform that computes target bounding - box regression deltas given proposal boxes and ground - truth boxes . The weights argument should be a 4 - tuple of multiplicative weights that are applied to the regression target .
def bbox_transform_inv(boxes, gt_boxes, weights=(1.0, 1.0, 1.0, 1.0)):
    """Inverse transform that computes target bounding-box regression deltas
    given proposal boxes and ground-truth boxes. The weights argument should be
    a 4-tuple of multiplicative weights that are applied to the regression
    target.

    In older versions of this code (and in py-faster-rcnn), the weights were set
    such that the regression deltas would have unit standard deviation on the
    training dataset. Presently, rather than computing these statistics exactly,
    we use a fixed set of weights (10., 10., 5., 5.) by default. These are
    approximately the weights one would get from COCO using the previous unit
    stdev heuristic.
    """
    ex_widths = boxes[:, 2] - boxes[:, 0] + 1.0
    ex_heights = boxes[:, 3] - boxes[:, 1] + 1.0
    ex_ctr_x = boxes[:, 0] + 0.5 * ex_widths
    ex_ctr_y = boxes[:, 1] + 0.5 * ex_heights

    gt_widths = gt_boxes[:, 2] - gt_boxes[:, 0] + 1.0
    gt_heights = gt_boxes[:, 3] - gt_boxes[:, 1] + 1.0
    gt_ctr_x = gt_boxes[:, 0] + 0.5 * gt_widths
    gt_ctr_y = gt_boxes[:, 1] + 0.5 * gt_heights

    wx, wy, ww, wh = weights
    targets_dx = wx * (gt_ctr_x - ex_ctr_x) / ex_widths
    targets_dy = wy * (gt_ctr_y - ex_ctr_y) / ex_heights
    targets_dw = ww * np.log(gt_widths / ex_widths)
    targets_dh = wh * np.log(gt_heights / ex_heights)

    targets = np.vstack((targets_dx, targets_dy, targets_dw,
                         targets_dh)).transpose()
    return targets
def bbox_transform_inv ( boxes , gt_boxes , weights = ( 1.0 , 1.0 , 1.0 , 1.0 ) ) : ex_widths = boxes [ : , 2 ] - boxes [ : , 0 ] + 1.0 ex_heights = boxes [ : , 3 ] - boxes [ : , 1 ] + 1.0 ex_ctr_x = boxes [ : , 0 ] + 0.5 * ex_widths ex_ctr_y = boxes [ : , 1 ] + 0.5 * ex_heights gt_widths = gt_boxes [ : , 2 ] - gt_boxes [ : , 0 ] + 1.0 gt_heights = gt_boxes [ : , 3 ] - gt_boxes [ : , 1 ] + 1.0 gt_ctr_x = gt_boxes [ : , 0 ] + 0.5 * gt_widths gt_ctr_y = gt_boxes [ : , 1 ] + 0.5 * gt_heights wx , wy , ww , wh = weights targets_dx = wx * ( gt_ctr_x - ex_ctr_x ) / ex_widths targets_dy = wy * ( gt_ctr_y - ex_ctr_y ) / ex_heights targets_dw = ww * np . log ( gt_widths / ex_widths ) targets_dh = wh * np . log ( gt_heights / ex_heights ) targets = np . vstack ( ( targets_dx , targets_dy , targets_dw , targets_dh ) ) . transpose ( ) return targets