parameters: (boxes, box_deltas, box_stds)
return_statement: return pred_boxes
docstring: 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]
docstring_summary: 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]
docstring_tokens: 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 ]
function: def bbox_pred(boxes, box_deltas, box_stds):
      """
      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]))
  
      widths = boxes[:, 2] - boxes[:, 0] + 1.0
      heights = boxes[:, 3] - boxes[:, 1] + 1.0
      ctr_x = boxes[:, 0] + 0.5 * (widths - 1.0)
      ctr_y = boxes[:, 1] + 0.5 * (heights - 1.0)
  
      dx = box_deltas[:, 0::4] * box_stds[0]
      dy = box_deltas[:, 1::4] * box_stds[1]
      dw = box_deltas[:, 2::4] * box_stds[2]
      dh = box_deltas[:, 3::4] * box_stds[3]
  
      pred_ctr_x = dx * widths[:, np.newaxis] + ctr_x[:, np.newaxis]
      pred_ctr_y = dy * heights[:, np.newaxis] + ctr_y[:, np.newaxis]
      pred_w = np.exp(dw) * widths[:, np.newaxis]
      pred_h = np.exp(dh) * heights[:, np.newaxis]
  
      pred_boxes = np.zeros(box_deltas.shape)
      # x1
      pred_boxes[:, 0::4] = pred_ctr_x - 0.5 * (pred_w - 1.0)
      # y1
      pred_boxes[:, 1::4] = pred_ctr_y - 0.5 * (pred_h - 1.0)
      # x2
      pred_boxes[:, 2::4] = pred_ctr_x + 0.5 * (pred_w - 1.0)
      # y2
      pred_boxes[:, 3::4] = pred_ctr_y + 0.5 * (pred_h - 1.0)
  
      return pred_boxes
function_tokens: def bbox_pred ( boxes , box_deltas , box_stds ) : if boxes . shape [ 0 ] == 0 : return np . zeros ( ( 0 , box_deltas . shape [ 1 ] ) ) widths = boxes [ : , 2 ] - boxes [ : , 0 ] + 1.0 heights = boxes [ : , 3 ] - boxes [ : , 1 ] + 1.0 ctr_x = boxes [ : , 0 ] + 0.5 * ( widths - 1.0 ) ctr_y = boxes [ : , 1 ] + 0.5 * ( heights - 1.0 ) dx = box_deltas [ : , 0 : : 4 ] * box_stds [ 0 ] dy = box_deltas [ : , 1 : : 4 ] * box_stds [ 1 ] dw = box_deltas [ : , 2 : : 4 ] * box_stds [ 2 ] dh = box_deltas [ : , 3 : : 4 ] * box_stds [ 3 ] pred_ctr_x = dx * widths [ : , np . newaxis ] + ctr_x [ : , np . newaxis ] pred_ctr_y = dy * heights [ : , np . newaxis ] + ctr_y [ : , np . newaxis ] pred_w = np . exp ( dw ) * widths [ : , np . newaxis ] pred_h = np . exp ( dh ) * heights [ : , np . newaxis ] pred_boxes = np . zeros ( box_deltas . shape ) # x1 pred_boxes [ : , 0 : : 4 ] = pred_ctr_x - 0.5 * ( pred_w - 1.0 ) # y1 pred_boxes [ : , 1 : : 4 ] = pred_ctr_y - 0.5 * ( pred_h - 1.0 ) # x2 pred_boxes [ : , 2 : : 4 ] = pred_ctr_x + 0.5 * ( pred_w - 1.0 ) # y2 pred_boxes [ : , 3 : : 4 ] = pred_ctr_y + 0.5 * ( pred_h - 1.0 ) return pred_boxes