def _get_instance_indices(self, classes, num_detections, batch_index, class_id):
    'Gets the instance indices that match the target class ID.\n\n    Args:\n      classes: A [batch_size, max_detections] int tensor with class indices for\n        all detected objects.\n      num_detections: A [batch_size] int tensor with the number of valid\n        detections for each image.\n      batch_index: An integer specifying the index for an example in the batch.\n      class_id: Class id\n\n    Returns:\n      instance_inds: A [num_instances] int tensor where each element indicates\n        the instance location within the `classes` tensor. This is useful to\n        associate the refined keypoints with the original detections (i.e.\n        boxes)\n    '
    classes = classes[batch_index:(batch_index + 1), ...]
    (_, max_detections) = shape_utils.combined_static_and_dynamic_shape(classes)
    valid_detections_with_kpt_class = tf.math.logical_and((tf.range(max_detections) < num_detections[batch_index]), (classes[0] == class_id))
    instance_inds = tf.where(valid_detections_with_kpt_class)[:, 0]
    return instance_inds
Gets the instance indices that match the target class ID.

Args:
  classes: A [batch_size, max_detections] int tensor with class indices for
    all detected objects.
  num_detections: A [batch_size] int tensor with the number of valid
    detections for each image.
  batch_index: An integer specifying the index for an example in the batch.
  class_id: Class id

Returns:
  instance_inds: A [num_instances] int tensor where each element indicates
    the instance location within the `classes` tensor. This is useful to
    associate the refined keypoints with the original detections (i.e.
    boxes)
def _get_instance_indices(self, classes, num_detections, batch_index, class_id):
    'Gets the instance indices that match the target class ID.\n\n    Args:\n      classes: A [batch_size, max_detections] int tensor with class indices for\n        all detected objects.\n      num_detections: A [batch_size] int tensor with the number of valid\n        detections for each image.\n      batch_index: An integer specifying the index for an example in the batch.\n      class_id: Class id\n\n    Returns:\n      instance_inds: A [num_instances] int tensor where each element indicates\n        the instance location within the `classes` tensor. This is useful to\n        associate the refined keypoints with the original detections (i.e.\n        boxes)\n    '
    classes = classes[batch_index:(batch_index + 1), ...]
    (_, max_detections) = shape_utils.combined_static_and_dynamic_shape(classes)
    valid_detections_with_kpt_class = tf.math.logical_and((tf.range(max_detections) < num_detections[batch_index]), (classes[0] == class_id))
    instance_inds = tf.where(valid_detections_with_kpt_class)[:, 0]
    return instance_inds