{"record":{"id":"0f47ef3d6377630d","repo":"tensorflow/models","slug":"maximum-change-in-aspect-ratio-must-be-between-0-a","errorCode":null,"errorMessage":"maximum change in aspect ratio must be between 0 and 0.5","messagePattern":"maximum change in aspect ratio must be between 0 and 0\\.5","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/yolo/ops/preprocessing_ops.py","lineNumber":384,"sourceCode":"      scaled dimension / original dimension.\n    cast([original_width, original_height, width, height, ptop, pleft, pbottom,\n      pright], tf.float32): a `Tensor` containing the information of the image\n        andthe applied preprocessing.\n  \"\"\"\n\n  def intersection(a, b):\n    \"\"\"Finds the intersection between 2 crops.\"\"\"\n    minx = tf.maximum(a[0], b[0])\n    miny = tf.maximum(a[1], b[1])\n    maxx = tf.minimum(a[2], b[2])\n    maxy = tf.minimum(a[3], b[3])\n    return tf.convert_to_tensor([minx, miny, maxx, maxy])\n\n  def cast(values, dtype):\n    return [tf.cast(value, dtype) for value in values]\n\n  if jitter > 0.5 or jitter < 0:\n    raise ValueError('maximum change in aspect ratio must be between 0 and 0.5')\n\n  with tf.name_scope('resize_and_jitter_image'):\n    # Cast all parameters to a usable float data type.\n    jitter = tf.cast(jitter, tf.float32)\n    original_dtype, original_dims = image.dtype, tf.shape(image)[:2]\n\n    # original width, original height, desigered width, desired height\n    original_width, original_height, width, height = cast(\n        [original_dims[1], original_dims[0], desired_size[1], desired_size[0]],\n        tf.float32)\n\n    # Compute the random delta width and height etc. and randomize the\n    # location of the corner points.\n    jitter_width = original_width * jitter\n    jitter_height = original_height * jitter\n    pleft = random_uniform_strong(\n        -jitter_width, jitter_width, jitter_width.dtype, seed=seed)\n    pright = random_uniform_strong(","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/yolo/ops/preprocessing_ops.py#L366-L402","documentation":"Error \"maximum change in aspect ratio must be between 0 and 0.5\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/yolo/ops/preprocessing_ops.py:384 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}