'Bounding-box regression targets (bbox_target_data) are stored in a
compact form N x (tx, ty, tw, th)
This function expands those targets into the 4-of-4*K representation used
by the network (i.e. only one class has non-zero targets).
Returns:
bbox_targets (ndarray): N x 4K blob of regression targets
bbox_inside_weights (ndarray): N x 4K blob of loss weights'

def _get_bbox_regression_labels(self, bbox_target_data, labels):

    bbox_targets = np.zeros((self.num_rois, (4 * self.num_classes)), dtype=np.float32)
    bbox_inside_weights = np.zeros(bbox_targets.shape, dtype=np.float32)
    inds = np.where((labels > 0))[0]
    for ind in inds:
        l = labels[ind]
        start = int((4 * l))
        end = int((start + 4))
        bbox_targets[ind, start:end] = bbox_target_data[ind]
        bbox_inside_weights[ind, start:end] = 1.0
    return (bbox_targets, bbox_inside_weights)
