tensorflow/models · error · ValueError
keypoints are provided but keypoints_flip_permutation is not
Error message
keypoints are provided but keypoints_flip_permutation is not provided
What it means
Error "keypoints are provided but keypoints_flip_permutation is not provided" thrown in tensorflow/models.
Source
Thrown at official/vision/utils/object_detection/preprocessor.py:228
boxes: rank 2 float32 tensor containing the bounding boxes -> [N, 4].
Boxes are in normalized form meaning their coordinates vary
between [0, 1].
masks: rank 3 float32 tensor with shape [num_instances, height, width]
containing instance masks.
keypoints: rank 3 float32 tensor with shape
[num_instances, num_keypoints, 2]
Raises:
ValueError: if keypoints are provided but keypoint_flip_permutation is not.
"""
def _flip_image(image):
# flip image
image_flipped = tf.image.flip_left_right(image)
return image_flipped
if keypoints is not None and keypoint_flip_permutation is None:
raise ValueError(
'keypoints are provided but keypoints_flip_permutation is not provided')
with tf.name_scope('RandomHorizontalFlip'):
result = []
# random variable defining whether to do flip or not
do_a_flip_random = tf.greater(tf.random.uniform([], seed=seed), 0.5)
# flip image
image = tf.cond(
pred=do_a_flip_random,
true_fn=lambda: _flip_image(image),
false_fn=lambda: image)
result.append(image)
# flip boxes
if boxes is not None:
boxes = tf.cond(
pred=do_a_flip_random,View on GitHub (pinned to e006f5f0d5)
Solutions
- Provide keypoints_flip_permutation whenever keypoints are used with horizontal flip.
- Remove keypoints from the data or disable flipping.
When it happens
Trigger: Thrown at official/vision/utils/object_detection/preprocessor.py:228 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/fddbe6c2a5ac8f37.
Report an issue: GitHub.