def _process_detection_boxes(self, detections_box_tuples):
    """Pre-processes boxes before adding them to the VRDDetectionEvaluation.

    In case of phrase evaluation task, evaluation expects exactly one bounding
    box containing all objects in the phrase. This bounding box is computed
    as an enclosing box of all groundtruth boxes of a phrase.

    Args:
      detections_box_tuples: A numpy array of structures with the shape
        [M, 1], each structure containing the same number of named bounding
        boxes. Each box is of the format [y_min, x_min, y_max, x_max]. See
        vrd_box_data_type for an example of this structure.

    Returns:
      result: A numpy array of structures with the shape [M, 1], each
        structure containing exactly one named bounding box. i-th output
        structure corresponds to the result of processing i-th input structure,
        where the named bounding box is computed as an enclosing bounding box
        of all bounding boxes of the i-th input structure.
    """
    first_box_key = next(six.iterkeys(detections_box_tuples.dtype.fields))
    miny = detections_box_tuples[first_box_key][:, 0]
    minx = detections_box_tuples[first_box_key][:, 1]
    maxy = detections_box_tuples[first_box_key][:, 2]
    maxx = detections_box_tuples[first_box_key][:, 3]
    for fields in detections_box_tuples.dtype.fields:
      miny = np.minimum(detections_box_tuples[fields][:, 0], miny)
      minx = np.minimum(detections_box_tuples[fields][:, 1], minx)
      maxy = np.maximum(detections_box_tuples[fields][:, 2], maxy)
      maxx = np.maximum(detections_box_tuples[fields][:, 3], maxx)
    data_result = []
    for i in range(detections_box_tuples.shape[0]):
      data_result.append(([miny[i], minx[i], maxy[i], maxx[i]],))
    result = np.array(data_result, dtype=[('box', 'f4', (4,))])
    return result
Pre-processes boxes before adding them to the VRDDetectionEvaluation.

    In case of phrase evaluation task, evaluation expects exactly one bounding
    box containing all objects in the phrase. This bounding box is computed
    as an enclosing box of all groundtruth boxes of a phrase.

    Args:
      detections_box_tuples: A numpy array of structures with the shape
        [M, 1], each structure containing the same number of named bounding
        boxes. Each box is of the format [y_min, x_min, y_max, x_max]. See
        vrd_box_data_type for an example of this structure.

    Returns:
      result: A numpy array of structures with the shape [M, 1], each
        structure containing exactly one named bounding box. i-th output
        structure corresponds to the result of processing i-th input structure,
        where the named bounding box is computed as an enclosing bounding box
        of all bounding boxes of the i-th input structure.
    
inference_api/src/main/object_detection/utils/vrd_evaluation.py