{"record":{"id":"7a467bd964ed0c63","repo":"tensorflow/models","slug":"image-rank-4-is-not-supported","errorCode":null,"errorMessage":"Image rank 4 is not supported","messagePattern":"Image rank 4 is not supported","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/ops/augment.py","lineNumber":1262,"sourceCode":"    aug_func: Augmentation function that will be applied to the\n      subsections of image indicated by the bbox values in bboxes.\n    func_changes_bbox: Boolean. Does augmentation_func return bbox in addition\n      to image.\n    *args: Additional parameters that will be passed into augmentation_func\n      when it is called.\n\n  Returns:\n    A modified version of image, where each bbox location in the image will\n    have augmentation_func applied to it if it is chosen to be called with\n    probability prob independently across all bboxes. Also the final\n    bboxes are returned that will be unchanged if func_changes_bbox is set to\n    false and if true, the new altered ones will be returned.\n\n  Raises:\n    ValueError if applied to video.\n  \"\"\"\n  if image.shape.rank == 4:\n    raise ValueError('Image rank 4 is not supported')\n\n  # Will keep track of the new altered bboxes after aug_func is repeatedly\n  # applied. The -1 values are a dummy value and this first Tensor will be\n  # removed upon appending the first real bbox.\n  new_bboxes = tf.constant(_INVALID_BOX)\n\n  # If the bboxes are empty, then just give it _INVALID_BOX. The result\n  # will be thrown away.\n  bboxes = tf.cond(tf.equal(tf.size(bboxes), 0),\n                   lambda: tf.constant(_INVALID_BOX),\n                   lambda: bboxes)\n\n  bboxes = tf.ensure_shape(bboxes, (None, 4))\n\n  # pylint:disable=g-long-lambda\n  wrapped_aug_func = (\n      lambda _image, bbox, _new_bboxes: _apply_bbox_augmentation_wrapper(\n          _image, bbox, _new_bboxes, prob, aug_func, func_changes_bbox, *args))","sourceCodeStart":1244,"sourceCodeEnd":1280,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/ops/augment.py#L1244-L1280","documentation":"Error \"Image rank 4 is not supported\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/ops/augment.py:1262 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Process images one at a time (rank 3); this op does not accept a batched rank-4 image.","Loop over the batch or use a batched-compatible augmentation op."],"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"}