code: def center_of_mass(mask, esp=1e-6):
      """Calculate the centroid coordinates of the mask.
  
      Args:
          mask (Tensor): The mask to be calculated, shape (h, w).
          esp (float): Avoid dividing by zero. Default: 1e-6.
  
      Returns:
          tuple[Tensor]: the coordinates of the center point of the mask.
  
              - center_h (Tensor): the center point of the height.
              - center_w (Tensor): the center point of the width.
      """
      h, w = mask.shape
      grid_h = torch.arange(h, device=mask.device)[:, None]
      grid_w = torch.arange(w, device=mask.device)
      normalizer = mask.sum().float().clamp(min=esp)
      center_h = (mask * grid_h).sum() / normalizer
      center_w = (mask * grid_w).sum() / normalizer
      return center_h, center_w
  
imports: from functools import partial
  from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  from mmengine.structures import InstanceData
  from mmengine.utils import digit_version
  from six.moves import map, zip
  from torch import Tensor
  from torch.autograd import Function
  from torch.nn import functional
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import BaseBoxes, get_box_type, stack_boxes
  from mmdet.structures.mask import BitmapMasks, PolygonMasks
  from mmdet.utils import OptInstanceList
label_desc: Use image node_id 10 for calling a global function with example usage: center_of_mass(mask, esp) and returns: center_h,  center_w