{"record":{"id":"a5bcdac98cc5827f","repo":"tensorflow/models","slug":"boxes-shape-1-is-d-but-must-be-4-a5bcda","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":540,"sourceCode":"    boxes: a tensor whose last dimension is 4 representing the coordinates of\n      boxes in ymin, xmin, ymax, xmax order.\n    scores: a tensor whose shape is the same as tf.shape(boxes)[:-1]\n      representing the original scores of the boxes.\n    image_shape: a tensor whose shape is the same as, or `broadcastable` to\n      `boxes` except the last dimension, which is 2, representing [height,\n      width] of the scaled image.\n    min_size_threshold: a float representing the minimal box size in each side\n      (w.r.t. the scaled image). Boxes whose sides are smaller than it will be\n      filtered out.\n\n  Returns:\n    filtered_boxes: a tensor whose shape is the same as `boxes` but with\n      the position of the filtered boxes are filled with 0.\n    filtered_scores: a tensor whose shape is the same as 'scores' but with\n      the positinon of the filtered boxes filled with 0.\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  with tf.name_scope('filter_boxes'):\n    if isinstance(image_shape, list) or isinstance(image_shape, tuple):\n      height, width = image_shape\n    else:\n      image_shape = tf.cast(image_shape, dtype=boxes.dtype)\n      height = image_shape[..., 0]\n      width = image_shape[..., 1]\n\n    ymin = boxes[..., 0]\n    xmin = boxes[..., 1]\n    ymax = boxes[..., 2]\n    xmax = boxes[..., 3]\n\n    h = ymax - ymin + 1.0\n    w = xmax - xmin + 1.0\n    yc = ymin + 0.5 * h","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/detection/utils/box_utils.py#L522-L558","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:540 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"}