def _postprocess_keypoints(self, prediction_dict, classes, y_indices, x_indices, boxes, num_detections):
    'Performs postprocessing on keypoint predictions.\n\n    Args:\n      prediction_dict: a dictionary holding predicted tensors, returned from the\n        predict() method. This dictionary should contain keypoint prediction\n        feature maps for each keypoint task.\n      classes: A [batch_size, max_detections] int tensor with class indices for\n        all detected objects.\n      y_indices: A [batch_size, max_detections] int tensor with y indices for\n        all object centers.\n      x_indices: A [batch_size, max_detections] int tensor with x indices for\n        all object centers.\n      boxes: A [batch_size, max_detections, 4] float32 tensor with bounding\n        boxes in (un-normalized) output space.\n      num_detections: A [batch_size] int tensor with the number of valid\n        detections for each image.\n\n    Returns:\n      A tuple of\n      keypoints: a [batch_size, max_detection, num_total_keypoints, 2] float32\n        tensor with keypoints in the output (strided) coordinate frame.\n      keypoint_scores: a [batch_size, max_detections, num_total_keypoints]\n        float32 tensor with keypoint scores.\n    '
    total_num_keypoints = sum((len(kp_dict.keypoint_indices) for kp_dict in self._kp_params_dict.values()))
    (batch_size, max_detections, _) = _get_shape(boxes, 3)
    kpt_coords_for_example_list = []
    kpt_scores_for_example_list = []
    for ex_ind in range(batch_size):
        kpt_coords_for_class_list = []
        kpt_scores_for_class_list = []
        instance_inds_for_class_list = []
        for (task_name, kp_params) in self._kp_params_dict.items():
            keypoint_heatmap = prediction_dict[get_keypoint_name(task_name, KEYPOINT_HEATMAP)][(- 1)]
            keypoint_offsets = prediction_dict[get_keypoint_name(task_name, KEYPOINT_OFFSET)][(- 1)]
            keypoint_regression = prediction_dict[get_keypoint_name(task_name, KEYPOINT_REGRESSION)][(- 1)]
            instance_inds = self._get_instance_indices(classes, num_detections, ex_ind, kp_params.class_id)

            def true_fn(keypoint_heatmap, keypoint_offsets, keypoint_regression, classes, y_indices, x_indices, boxes, instance_inds, ex_ind, kp_params):
                'Logics to execute when instance_inds is not an empty set.'
                (kpt_coords_for_class, kpt_scores_for_class) = self._postprocess_keypoints_for_class_and_image(keypoint_heatmap, keypoint_offsets, keypoint_regression, classes, y_indices, x_indices, boxes, instance_inds, ex_ind, kp_params)
                (kpts_coords_for_class_padded, kpt_scores_for_class_padded) = _pad_to_full_keypoint_dim(kpt_coords_for_class, kpt_scores_for_class, kp_params.keypoint_indices, total_num_keypoints)
                return (kpts_coords_for_class_padded, kpt_scores_for_class_padded)

            def false_fn():
                'Logics to execute when the instance_inds is an empty set.'
                return (tf.zeros([1, 0, total_num_keypoints, 2], dtype=tf.float32), tf.zeros([1, 0, total_num_keypoints], dtype=tf.float32))
            true_fn = functools.partial(true_fn, keypoint_heatmap, keypoint_offsets, keypoint_regression, classes, y_indices, x_indices, boxes, instance_inds, ex_ind, kp_params)
            results = tf.cond((tf.size(instance_inds) > 0), true_fn, false_fn)
            kpt_coords_for_class_list.append(results[0])
            kpt_scores_for_class_list.append(results[1])
            instance_inds_for_class_list.append(instance_inds)
        kpt_coords_for_example = tf.concat(kpt_coords_for_class_list, axis=1)
        kpt_scores_for_example = tf.concat(kpt_scores_for_class_list, axis=1)
        instance_inds_for_example = tf.concat(instance_inds_for_class_list, axis=0)
        if (tf.size(instance_inds_for_example) > 0):
            (kpt_coords_for_example_all_det, kpt_scores_for_example_all_det) = _pad_to_full_instance_dim(kpt_coords_for_example, kpt_scores_for_example, instance_inds_for_example, self._center_params.max_box_predictions)
        else:
            kpt_coords_for_example_all_det = tf.zeros([1, max_detections, total_num_keypoints, 2], dtype=tf.float32)
            kpt_scores_for_example_all_det = tf.zeros([1, max_detections, total_num_keypoints], dtype=tf.float32)
        kpt_coords_for_example_list.append(kpt_coords_for_example_all_det)
        kpt_scores_for_example_list.append(kpt_scores_for_example_all_det)
    keypoints = tf.concat(kpt_coords_for_example_list, axis=0)
    keypoint_scores = tf.concat(kpt_scores_for_example_list, axis=0)
    return (keypoints, keypoint_scores)
Performs postprocessing on keypoint predictions.

Args:
  prediction_dict: a dictionary holding predicted tensors, returned from the
    predict() method. This dictionary should contain keypoint prediction
    feature maps for each keypoint task.
  classes: A [batch_size, max_detections] int tensor with class indices for
    all detected objects.
  y_indices: A [batch_size, max_detections] int tensor with y indices for
    all object centers.
  x_indices: A [batch_size, max_detections] int tensor with x indices for
    all object centers.
  boxes: A [batch_size, max_detections, 4] float32 tensor with bounding
    boxes in (un-normalized) output space.
  num_detections: A [batch_size] int tensor with the number of valid
    detections for each image.

Returns:
  A tuple of
  keypoints: a [batch_size, max_detection, num_total_keypoints, 2] float32
    tensor with keypoints in the output (strided) coordinate frame.
  keypoint_scores: a [batch_size, max_detections, num_total_keypoints]
    float32 tensor with keypoint scores.
def _postprocess_keypoints(self, prediction_dict, classes, y_indices, x_indices, boxes, num_detections):
    'Performs postprocessing on keypoint predictions.\n\n    Args:\n      prediction_dict: a dictionary holding predicted tensors, returned from the\n        predict() method. This dictionary should contain keypoint prediction\n        feature maps for each keypoint task.\n      classes: A [batch_size, max_detections] int tensor with class indices for\n        all detected objects.\n      y_indices: A [batch_size, max_detections] int tensor with y indices for\n        all object centers.\n      x_indices: A [batch_size, max_detections] int tensor with x indices for\n        all object centers.\n      boxes: A [batch_size, max_detections, 4] float32 tensor with bounding\n        boxes in (un-normalized) output space.\n      num_detections: A [batch_size] int tensor with the number of valid\n        detections for each image.\n\n    Returns:\n      A tuple of\n      keypoints: a [batch_size, max_detection, num_total_keypoints, 2] float32\n        tensor with keypoints in the output (strided) coordinate frame.\n      keypoint_scores: a [batch_size, max_detections, num_total_keypoints]\n        float32 tensor with keypoint scores.\n    '
    total_num_keypoints = sum((len(kp_dict.keypoint_indices) for kp_dict in self._kp_params_dict.values()))
    (batch_size, max_detections, _) = _get_shape(boxes, 3)
    kpt_coords_for_example_list = []
    kpt_scores_for_example_list = []
    for ex_ind in range(batch_size):
        kpt_coords_for_class_list = []
        kpt_scores_for_class_list = []
        instance_inds_for_class_list = []
        for (task_name, kp_params) in self._kp_params_dict.items():
            keypoint_heatmap = prediction_dict[get_keypoint_name(task_name, KEYPOINT_HEATMAP)][(- 1)]
            keypoint_offsets = prediction_dict[get_keypoint_name(task_name, KEYPOINT_OFFSET)][(- 1)]
            keypoint_regression = prediction_dict[get_keypoint_name(task_name, KEYPOINT_REGRESSION)][(- 1)]
            instance_inds = self._get_instance_indices(classes, num_detections, ex_ind, kp_params.class_id)

            def true_fn(keypoint_heatmap, keypoint_offsets, keypoint_regression, classes, y_indices, x_indices, boxes, instance_inds, ex_ind, kp_params):
                'Logics to execute when instance_inds is not an empty set.'
                (kpt_coords_for_class, kpt_scores_for_class) = self._postprocess_keypoints_for_class_and_image(keypoint_heatmap, keypoint_offsets, keypoint_regression, classes, y_indices, x_indices, boxes, instance_inds, ex_ind, kp_params)
                (kpts_coords_for_class_padded, kpt_scores_for_class_padded) = _pad_to_full_keypoint_dim(kpt_coords_for_class, kpt_scores_for_class, kp_params.keypoint_indices, total_num_keypoints)
                return (kpts_coords_for_class_padded, kpt_scores_for_class_padded)

            def false_fn():
                'Logics to execute when the instance_inds is an empty set.'
                return (tf.zeros([1, 0, total_num_keypoints, 2], dtype=tf.float32), tf.zeros([1, 0, total_num_keypoints], dtype=tf.float32))
            true_fn = functools.partial(true_fn, keypoint_heatmap, keypoint_offsets, keypoint_regression, classes, y_indices, x_indices, boxes, instance_inds, ex_ind, kp_params)
            results = tf.cond((tf.size(instance_inds) > 0), true_fn, false_fn)
            kpt_coords_for_class_list.append(results[0])
            kpt_scores_for_class_list.append(results[1])
            instance_inds_for_class_list.append(instance_inds)
        kpt_coords_for_example = tf.concat(kpt_coords_for_class_list, axis=1)
        kpt_scores_for_example = tf.concat(kpt_scores_for_class_list, axis=1)
        instance_inds_for_example = tf.concat(instance_inds_for_class_list, axis=0)
        if (tf.size(instance_inds_for_example) > 0):
            (kpt_coords_for_example_all_det, kpt_scores_for_example_all_det) = _pad_to_full_instance_dim(kpt_coords_for_example, kpt_scores_for_example, instance_inds_for_example, self._center_params.max_box_predictions)
        else:
            kpt_coords_for_example_all_det = tf.zeros([1, max_detections, total_num_keypoints, 2], dtype=tf.float32)
            kpt_scores_for_example_all_det = tf.zeros([1, max_detections, total_num_keypoints], dtype=tf.float32)
        kpt_coords_for_example_list.append(kpt_coords_for_example_all_det)
        kpt_scores_for_example_list.append(kpt_scores_for_example_all_det)
    keypoints = tf.concat(kpt_coords_for_example_list, axis=0)
    keypoint_scores = tf.concat(kpt_scores_for_example_list, axis=0)
    return (keypoints, keypoint_scores)