class_docstr: CenterNet network using Hourglass from https://arxiv.org/abs/1904.07850S.
class_docstr_tok: ["CenterNet","network","using","Hourglass","from","https",":","\/\/arxiv.org\/abs\/1904.07850S","."]
docstr: Get top scores from heatmaps.
docstr_tok: ["Get","top","scores","from","heatmaps","."]
code: def _top_scores_heatmaps(centers, k):
      """Get top scores from heatmaps."""
      b, h, w, c = centers.shape
      centers_t = tf.transpose(centers, [0, 3, 1, 2])
      scores, indices = tf.math.top_k(
          tf.reshape(centers_t, [b, c, -1]), k
      )
      topk_inds = indices % (h * w)
      topk_ys = tf.cast(tf.cast((indices / w), tf.int32), tf.float32)
      topk_xs = tf.cast(tf.cast((indices % w), tf.int32), tf.float32)
      scores, indices = tf.math.top_k(tf.reshape(scores, [b, -1]), k)
      topk_classes = tf.cast(indices / k, tf.int32)
      topk_inds = tf.gather(
          tf.reshape(topk_inds, [b, -1]), indices, axis=1, batch_dims=1
      )
      ys = tf.gather(
          tf.reshape(topk_ys, [b, -1]), indices, axis=1, batch_dims=1
      )
      xs = tf.gather(
          tf.reshape(topk_xs, [b, -1]), indices, axis=1, batch_dims=1
      )
  
      return xs, ys, topk_classes, topk_inds, scores
  
imports: import collections
  import os
  import random
  import string
  import time
  from absl import logging
  import numpy
  import tensorflow
  from tensorflow_graphics.projects.points_to_3Dobjects.models import centernet_utils
  from tensorflow_graphics.projects.points_to_3Dobjects.networks import hourglass
  from tensorflow_graphics.projects.points_to_3Dobjects.transforms import transforms
  from tensorflow_graphics.projects.points_to_3Dobjects.utils import image
  from google3.pyglib import gfile
label_desc: Use image node_id 13 for calling the CenterNetVID obj's underlying member method code with example usage: obj._top_scores_heatmaps(centers, k) and returns: xs,  ys,  topk_classes,  topk_inds,  scores