{"record":{"id":"82280a142134e3be","repo":"tensorflow/models","slug":"input-must-be-of-size-n-4","errorCode":null,"errorMessage":"Input must be of size [N, 4]","messagePattern":"Input must be of size \\[N, 4\\]","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/utils/object_detection/visualization_utils.py","lineNumber":302,"sourceCode":"\n  Args:\n    image: a PIL.Image object.\n    boxes: a 2 dimensional numpy array of [N, 4]: (ymin, xmin, ymax, xmax). The\n      coordinates are in normalized format between [0, 1].\n    color: color to draw bounding box. Default is red.\n    thickness: line thickness. Default value is 4.\n    display_str_list_list: list of list of strings. a list of strings for each\n      bounding box. The reason to pass a list of strings for a bounding box is\n      that it might contain multiple labels.\n\n  Raises:\n    ValueError: if boxes is not a [N, 4] array\n  \"\"\"\n  boxes_shape = boxes.shape\n  if not boxes_shape:\n    return\n  if len(boxes_shape) != 2 or boxes_shape[1] != 4:\n    raise ValueError('Input must be of size [N, 4]')\n  for i in range(boxes_shape[0]):\n    display_str_list = ()\n    if display_str_list_list:\n      display_str_list = display_str_list_list[i]\n    draw_bounding_box_on_image(image, boxes[i, 0], boxes[i, 1], boxes[i, 2],\n                               boxes[i, 3], color, thickness, display_str_list)\n\n\ndef _visualize_boxes(image, boxes, classes, scores, category_index, **kwargs):\n  return visualize_boxes_and_labels_on_image_array(\n      image, boxes, classes, scores, category_index=category_index, **kwargs)\n\n\ndef _visualize_boxes_and_masks(image, boxes, classes, scores, masks,\n                               category_index, **kwargs):\n  return visualize_boxes_and_labels_on_image_array(\n      image,\n      boxes,","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/utils/object_detection/visualization_utils.py#L284-L320","documentation":"Error \"Input must be of size [N, 4]\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/utils/object_detection/visualization_utils.py:302 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass input with shape [N, 4].","Reshape the array so each row holds 4 values."],"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"}