{"record":{"id":"fddbe6c2a5ac8f37","repo":"tensorflow/models","slug":"keypoints-are-provided-but-keypoints-flip-permutat","errorCode":null,"errorMessage":"keypoints are provided but keypoints_flip_permutation is not provided","messagePattern":"keypoints are provided but keypoints_flip_permutation is not provided","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/utils/object_detection/preprocessor.py","lineNumber":228,"sourceCode":"    boxes: rank 2 float32 tensor containing the bounding boxes -> [N, 4].\n           Boxes are in normalized form meaning their coordinates vary\n           between [0, 1].\n    masks: rank 3 float32 tensor with shape [num_instances, height, width]\n           containing instance masks.\n    keypoints: rank 3 float32 tensor with shape\n               [num_instances, num_keypoints, 2]\n\n  Raises:\n    ValueError: if keypoints are provided but keypoint_flip_permutation is not.\n  \"\"\"\n\n  def _flip_image(image):\n    # flip image\n    image_flipped = tf.image.flip_left_right(image)\n    return image_flipped\n\n  if keypoints is not None and keypoint_flip_permutation is None:\n    raise ValueError(\n        'keypoints are provided but keypoints_flip_permutation is not provided')\n\n  with tf.name_scope('RandomHorizontalFlip'):\n    result = []\n    # random variable defining whether to do flip or not\n    do_a_flip_random = tf.greater(tf.random.uniform([], seed=seed), 0.5)\n\n    # flip image\n    image = tf.cond(\n        pred=do_a_flip_random,\n        true_fn=lambda: _flip_image(image),\n        false_fn=lambda: image)\n    result.append(image)\n\n    # flip boxes\n    if boxes is not None:\n      boxes = tf.cond(\n          pred=do_a_flip_random,","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/utils/object_detection/preprocessor.py#L210-L246","documentation":"Error \"keypoints are provided but keypoints_flip_permutation is not provided\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/utils/object_detection/preprocessor.py:228 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide keypoints_flip_permutation whenever keypoints are used with horizontal flip.","Remove keypoints from the data or disable flipping."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}