(boxes, box_deltas)
return pred_boxes
Transform the set of class-agnostic boxes into class-specific boxes
    by applying the predicted offsets (box_deltas)
    :param boxes: !important [N 4]
    :param box_deltas: [N, 4 * num_classes]
    :return: [N 4 * num_classes]
Transform the set of class-agnostic boxes into class-specific boxes
    by applying the predicted offsets (box_deltas)
    :param boxes: !important [N 4]
    :param box_deltas: [N, 4 * num_classes]
    :return: [N 4 * num_classes]
Transform the set of class - agnostic boxes into class - specific boxes by applying the predicted offsets ( box_deltas ) : param boxes : !important [ N 4 ] : param box_deltas : [ N 4 * num_classes ] : return : [ N 4 * num_classes ]
def iou_pred(boxes, box_deltas):
    """
    Transform the set of class-agnostic boxes into class-specific boxes
    by applying the predicted offsets (box_deltas)
    :param boxes: !important [N 4]
    :param box_deltas: [N, 4 * num_classes]
    :return: [N 4 * num_classes]
    """
    if boxes.shape[0] == 0:
        return np.zeros((0, box_deltas.shape[1]))

    boxes = boxes.astype(np.float, copy=False)
    x1 = boxes[:, 0]
    y1 = boxes[:, 1]
    x2 = boxes[:, 2]
    y2 = boxes[:, 3]

    dx1 = box_deltas[:, 0::4]
    dy1 = box_deltas[:, 1::4]
    dx2 = box_deltas[:, 2::4]
    dy2 = box_deltas[:, 3::4]

    pred_boxes = np.zeros(box_deltas.shape)
    # x1
    pred_boxes[:, 0::4] = dx1 + x1[:, np.newaxis]
    # y1
    pred_boxes[:, 1::4] = dy1 + y1[:, np.newaxis]
    # x2
    pred_boxes[:, 2::4] = dx2 + x2[:, np.newaxis]
    # y2
    pred_boxes[:, 3::4] = dy2 + y2[:, np.newaxis]

    return pred_boxes
def iou_pred ( boxes , box_deltas ) : if boxes . shape [ 0 ] == 0 : return np . zeros ( ( 0 , box_deltas . shape [ 1 ] ) ) boxes = boxes . astype ( np . float , copy = False ) x1 = boxes [ : , 0 ] y1 = boxes [ : , 1 ] x2 = boxes [ : , 2 ] y2 = boxes [ : , 3 ] dx1 = box_deltas [ : , 0 : : 4 ] dy1 = box_deltas [ : , 1 : : 4 ] dx2 = box_deltas [ : , 2 : : 4 ] dy2 = box_deltas [ : , 3 : : 4 ] pred_boxes = np . zeros ( box_deltas . shape ) # x1 pred_boxes [ : , 0 : : 4 ] = dx1 + x1 [ : , np . newaxis ] # y1 pred_boxes [ : , 1 : : 4 ] = dy1 + y1 [ : , np . newaxis ] # x2 pred_boxes [ : , 2 : : 4 ] = dx2 + x2 [ : , np . newaxis ] # y2 pred_boxes [ : , 3 : : 4 ] = dy2 + y2 [ : , np . newaxis ] return pred_boxes