def compute_center(detections):
  """Compute the center for each detection.

  Args:
    detections:   A matrix of shape N * 4, recording the pixel coordinate of
                  each detection bounding box (inclusive).

  Returns:
    center:       A matrix of shape N I 2, representing the (x, y) coordinate
                  for each input bounding box center.
  """
  center = detections[:, [0, 1]] + detections[:, [2, 3]]
  center /= 2.
  return center