def convert_strided_predictions_to_normalized_keypoints(keypoint_coords, keypoint_scores, stride, true_image_shapes, clip_out_of_frame_keypoints=False):
    "Converts predictions in the output space to normalized keypoints.\n\n  If clip_out_of_frame_keypoints=False, keypoint coordinates falling outside\n  the valid image boundary are normalized but not clipped; If\n  clip_out_of_frame_keypoints=True, keypoint coordinates falling outside the\n  valid image boundary are clipped to the closest image boundary and the scores\n  will be set to 0.0.\n\n  Args:\n    keypoint_coords: A tensor of shape\n      [batch_size, num_instances, num_keypoints, 2] holding the raw coordinates\n      of keypoints in the model's output space.\n    keypoint_scores: A tensor of shape\n      [batch_size, num_instances, num_keypoints] holding the keypoint scores.\n    stride: The stride in the output space.\n    true_image_shapes: A tensor of shape [batch_size, 3] representing the true\n      shape of the input not considering padding.\n    clip_out_of_frame_keypoints: A boolean indicating whether keypoints outside\n      the image boundary should be clipped. If True, keypoint coords will be\n      clipped to image boundary. If False, keypoints are normalized but not\n      filtered based on their location.\n\n  Returns:\n    keypoint_coords_normalized: A tensor of shape\n      [batch_size, num_instances, num_keypoints, 2] representing the coordinates\n      of the normalized keypoints.\n    keypoint_scores: A tensor of shape\n      [batch_size, num_instances, num_keypoints] representing the updated\n      keypoint scores.\n  "
    (batch_size, _, _, _) = shape_utils.combined_static_and_dynamic_shape(keypoint_coords)
    (true_heights, true_widths, _) = tf.unstack(true_image_shapes, axis=1)
    yscale = (float(stride) / tf.cast(true_heights, tf.float32))
    xscale = (float(stride) / tf.cast(true_widths, tf.float32))
    yx_scale = tf.stack([yscale, xscale], axis=1)
    keypoint_coords_normalized = (keypoint_coords * tf.reshape(yx_scale, [batch_size, 1, 1, 2]))
    if clip_out_of_frame_keypoints:
        valid_indices = tf.logical_and(tf.logical_and((keypoint_coords_normalized[:, :, :, 0] >= 0.0), (keypoint_coords_normalized[:, :, :, 0] <= 1.0)), tf.logical_and((keypoint_coords_normalized[:, :, :, 1] >= 0.0), (keypoint_coords_normalized[:, :, :, 1] <= 1.0)))
        batch_window = tf.tile(tf.constant([[0.0, 0.0, 1.0, 1.0]], dtype=tf.float32), multiples=[batch_size, 1])

        def clip_to_window(inputs):
            (keypoints, window) = inputs
            return keypoint_ops.clip_to_window(keypoints, window)
        keypoint_coords_normalized = tf.map_fn(clip_to_window, (keypoint_coords_normalized, batch_window), dtype=tf.float32, back_prop=False)
        keypoint_scores = tf.where(valid_indices, keypoint_scores, tf.zeros_like(keypoint_scores))
    return (keypoint_coords_normalized, keypoint_scores)
Converts predictions in the output space to normalized keypoints.

If clip_out_of_frame_keypoints=False, keypoint coordinates falling outside
the valid image boundary are normalized but not clipped; If
clip_out_of_frame_keypoints=True, keypoint coordinates falling outside the
valid image boundary are clipped to the closest image boundary and the scores
will be set to 0.0.

Args:
  keypoint_coords: A tensor of shape
    [batch_size, num_instances, num_keypoints, 2] holding the raw coordinates
    of keypoints in the model's output space.
  keypoint_scores: A tensor of shape
    [batch_size, num_instances, num_keypoints] holding the keypoint scores.
  stride: The stride in the output space.
  true_image_shapes: A tensor of shape [batch_size, 3] representing the true
    shape of the input not considering padding.
  clip_out_of_frame_keypoints: A boolean indicating whether keypoints outside
    the image boundary should be clipped. If True, keypoint coords will be
    clipped to image boundary. If False, keypoints are normalized but not
    filtered based on their location.

Returns:
  keypoint_coords_normalized: A tensor of shape
    [batch_size, num_instances, num_keypoints, 2] representing the coordinates
    of the normalized keypoints.
  keypoint_scores: A tensor of shape
    [batch_size, num_instances, num_keypoints] representing the updated
    keypoint scores.
def convert_strided_predictions_to_normalized_keypoints(keypoint_coords, keypoint_scores, stride, true_image_shapes, clip_out_of_frame_keypoints=False):
    "Converts predictions in the output space to normalized keypoints.\n\n  If clip_out_of_frame_keypoints=False, keypoint coordinates falling outside\n  the valid image boundary are normalized but not clipped; If\n  clip_out_of_frame_keypoints=True, keypoint coordinates falling outside the\n  valid image boundary are clipped to the closest image boundary and the scores\n  will be set to 0.0.\n\n  Args:\n    keypoint_coords: A tensor of shape\n      [batch_size, num_instances, num_keypoints, 2] holding the raw coordinates\n      of keypoints in the model's output space.\n    keypoint_scores: A tensor of shape\n      [batch_size, num_instances, num_keypoints] holding the keypoint scores.\n    stride: The stride in the output space.\n    true_image_shapes: A tensor of shape [batch_size, 3] representing the true\n      shape of the input not considering padding.\n    clip_out_of_frame_keypoints: A boolean indicating whether keypoints outside\n      the image boundary should be clipped. If True, keypoint coords will be\n      clipped to image boundary. If False, keypoints are normalized but not\n      filtered based on their location.\n\n  Returns:\n    keypoint_coords_normalized: A tensor of shape\n      [batch_size, num_instances, num_keypoints, 2] representing the coordinates\n      of the normalized keypoints.\n    keypoint_scores: A tensor of shape\n      [batch_size, num_instances, num_keypoints] representing the updated\n      keypoint scores.\n  "
    (batch_size, _, _, _) = shape_utils.combined_static_and_dynamic_shape(keypoint_coords)
    (true_heights, true_widths, _) = tf.unstack(true_image_shapes, axis=1)
    yscale = (float(stride) / tf.cast(true_heights, tf.float32))
    xscale = (float(stride) / tf.cast(true_widths, tf.float32))
    yx_scale = tf.stack([yscale, xscale], axis=1)
    keypoint_coords_normalized = (keypoint_coords * tf.reshape(yx_scale, [batch_size, 1, 1, 2]))
    if clip_out_of_frame_keypoints:
        valid_indices = tf.logical_and(tf.logical_and((keypoint_coords_normalized[:, :, :, 0] >= 0.0), (keypoint_coords_normalized[:, :, :, 0] <= 1.0)), tf.logical_and((keypoint_coords_normalized[:, :, :, 1] >= 0.0), (keypoint_coords_normalized[:, :, :, 1] <= 1.0)))
        batch_window = tf.tile(tf.constant([[0.0, 0.0, 1.0, 1.0]], dtype=tf.float32), multiples=[batch_size, 1])

        def clip_to_window(inputs):
            (keypoints, window) = inputs
            return keypoint_ops.clip_to_window(keypoints, window)
        keypoint_coords_normalized = tf.map_fn(clip_to_window, (keypoint_coords_normalized, batch_window), dtype=tf.float32, back_prop=False)
        keypoint_scores = tf.where(valid_indices, keypoint_scores, tf.zeros_like(keypoint_scores))
    return (keypoint_coords_normalized, keypoint_scores)