{"record":{"id":"edaab38787025f7f","repo":"tensorflow/models","slug":"anchors-must-be-an-boxlist","errorCode":null,"errorMessage":"anchors must be an BoxList","messagePattern":"anchors must be an BoxList","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/utils/object_detection/target_assigner.py","lineNumber":130,"sourceCode":"        Matcher.\n\n    Returns:\n      cls_targets: a float32 tensor with shape [num_anchors, d_1, d_2 ... d_k],\n        where the subshape [d_1, ..., d_k] is compatible with groundtruth_labels\n        which has shape [num_gt_boxes, d_1, d_2, ... d_k].\n      cls_weights: a float32 tensor with shape [num_anchors]\n      reg_targets: a float32 tensor with shape [num_anchors, box_code_dimension]\n      reg_weights: a float32 tensor with shape [num_anchors]\n      match: a matcher.Match object encoding the match between anchors and\n        groundtruth boxes, with rows corresponding to groundtruth boxes\n        and columns corresponding to anchors.\n\n    Raises:\n      ValueError: if anchors or groundtruth_boxes are not of type\n        box_list.BoxList\n    \"\"\"\n    if not isinstance(anchors, box_list.BoxList):\n      raise ValueError('anchors must be an BoxList')\n    if not isinstance(groundtruth_boxes, box_list.BoxList):\n      raise ValueError('groundtruth_boxes must be an BoxList')\n\n    if groundtruth_labels is None:\n      groundtruth_labels = tf.ones(\n          tf.expand_dims(groundtruth_boxes.num_boxes(), 0))\n      groundtruth_labels = tf.expand_dims(groundtruth_labels, -1)\n    unmatched_shape_assert = shape_utils.assert_shape_equal(\n        shape_utils.combined_static_and_dynamic_shape(groundtruth_labels)[1:],\n        shape_utils.combined_static_and_dynamic_shape(\n            self._unmatched_cls_target))\n    labels_and_box_shapes_assert = shape_utils.assert_shape_equal(\n        shape_utils.combined_static_and_dynamic_shape(groundtruth_labels)[:1],\n        shape_utils.combined_static_and_dynamic_shape(\n            groundtruth_boxes.get())[:1])\n\n    if groundtruth_weights is None:\n      num_gt_boxes = groundtruth_boxes.num_boxes_static()","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/utils/object_detection/target_assigner.py#L112-L148","documentation":"Error \"anchors must be an BoxList\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/utils/object_detection/target_assigner.py:130 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass anchors as a BoxList instance.","Wrap the anchor tensor in box_list.BoxList(anchors)."],"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"}