code: def get_topk_from_heatmap(scores, k=20):
      """Get top k positions from heatmap.
  
      Args:
          scores (Tensor): Target heatmap with shape
              [batch, num_classes, height, width].
          k (int): Target number. Default: 20.
  
      Returns:
          tuple[torch.Tensor]: Scores, indexes, categories and coords of
              topk keypoint. Containing following Tensors:
  
          - topk_scores (Tensor): Max scores of each topk keypoint.
          - topk_inds (Tensor): Indexes of each topk keypoint.
          - topk_clses (Tensor): Categories of each topk keypoint.
          - topk_ys (Tensor): Y-coord of each topk keypoint.
          - topk_xs (Tensor): X-coord of each topk keypoint.
      """
      batch, _, height, width = scores.size()
      topk_scores, topk_inds = torch.topk(scores.view(batch, -1), k)
      topk_clses = topk_inds // (height * width)
      topk_inds = topk_inds % (height * width)
      topk_ys = topk_inds // width
      topk_xs = (topk_inds % width).int().float()
      return topk_scores, topk_inds, topk_clses, topk_ys, topk_xs
  
file_path: mmdetection/mmdet/models/utils/gaussian_target.py
imports: from math import sqrt
  import torch
  import torch.nn.functional
label_desc: Use image node_id 5 for calling a global function with example usage: get_topk_from_heatmap(scores, k) and returns: topk_scores,  topk_inds,  topk_clses,  topk_ys,  topk_xs