{"record":{"id":"b27ec125ac235c67","repo":"tensorflow/models","slug":"boxes-shape-1-is-d-but-must-be-4","errorCode":null,"errorMessage":"boxes.shape[-1] is {:d}, but must be 4.","messagePattern":"boxes\\.shape\\[-1\\] is (.+?), but must be 4\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/detection/utils/box_utils.py","lineNumber":58,"sourceCode":"    tf.summary.image('bounding_box_summary', image_summary, step=step)\n    summary_writer.flush()\n\n\ndef yxyx_to_xywh(boxes):\n  \"\"\"Converts boxes from ymin, xmin, ymax, xmax to xmin, ymin, width, height.\n\n  Args:\n    boxes: a numpy array whose last dimension is 4 representing the coordinates\n      of boxes in ymin, xmin, ymax, xmax order.\n\n  Returns:\n    boxes: a numpy array whose shape is the same as `boxes` in new format.\n\n  Raises:\n    ValueError: If the last dimension of boxes is not 4.\n  \"\"\"\n  if boxes.shape[-1] != 4:\n    raise ValueError('boxes.shape[-1] is {:d}, but must be 4.'.format(\n        boxes.shape[-1]))\n\n  boxes_ymin = boxes[..., 0]\n  boxes_xmin = boxes[..., 1]\n  boxes_width = boxes[..., 3] - boxes[..., 1]\n  boxes_height = boxes[..., 2] - boxes[..., 0]\n  new_boxes = np.stack([boxes_xmin, boxes_ymin, boxes_width, boxes_height],\n                       axis=-1)\n\n  return new_boxes\n\n\ndef jitter_boxes(boxes, noise_scale=0.025):\n  \"\"\"Jitter the box coordinates by some noise distribution.\n\n  Args:\n    boxes: a tensor whose last dimension is 4 representing the coordinates of\n      boxes in ymin, xmin, ymax, xmax order.","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/detection/utils/box_utils.py#L40-L76","documentation":"Error \"boxes.shape[-1] is {:d}, but must be 4.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/detection/utils/box_utils.py:58 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"}