'given ground truth, prepare roidb
:param box_list: [image_index] ndarray of [box_index][x1, x2, y1, y2]
:param gt_roidb: [image_index][\'boxes\', \'gt_classes\', \'gt_overlaps\', \'flipped\']
:return: roidb: [image_index][\'boxes\', \'gt_classes\', \'gt_overlaps\', \'flipped\']'

def create_roidb_from_box_list(self, box_list, gt_roidb):

    assert (len(box_list) == self.num_images), 'number    of    boxes    matrix    must    match    number    of    images'
    roidb = []
    for i in range(self.num_images):
        roi_rec = dict()
        roi_rec['image'] = gt_roidb[i]['image']
        roi_rec['height'] = gt_roidb[i]['height']
        roi_rec['width'] = gt_roidb[i]['width']
        boxes = box_list[i]
        if (boxes.shape[1] == 5):
            boxes = boxes[:, :4]
        num_boxes = boxes.shape[0]
        overlaps = np.zeros((num_boxes, self.num_classes), dtype=np.float32)
        if ((gt_roidb is not None) and (gt_roidb[i]['boxes'].size > 0)):
            gt_boxes = gt_roidb[i]['boxes']
            gt_classes = gt_roidb[i]['gt_classes']
            gt_overlaps = bbox_overlaps(boxes.astype(np.float), gt_boxes.astype(np.float))
            argmaxes = gt_overlaps.argmax(axis=1)
            maxes = gt_overlaps.max(axis=1)
            I = np.where((maxes > 0))[0]
            overlaps[(I, gt_classes[argmaxes[I]])] = maxes[I]
        roi_rec.update({'boxes': boxes, 'gt_classes': np.zeros((num_boxes,), dtype=np.int32), 'gt_overlaps': overlaps, 'max_classes': overlaps.argmax(axis=1), 'max_overlaps': overlaps.max(axis=1), 'flipped': False})
        zero_indexes = np.where((roi_rec['max_overlaps'] == 0))[0]
        assert all((roi_rec['max_classes'][zero_indexes] == 0))
        nonzero_indexes = np.where((roi_rec['max_overlaps'] > 0))[0]
        assert all((roi_rec['max_classes'][nonzero_indexes] != 0))
        roidb.append(roi_rec)
    return roidb
