{"record":{"id":"0fad7f4e214e774b","repo":"tensorflow/models","slug":"attribute-learning-is-only-supported-for-nmsv1-but","errorCode":null,"errorMessage":"Attribute learning is only supported for NMSv1 but NMS {} is used.","messagePattern":"Attribute learning is only supported for NMSv1 but NMS (.+?) is used\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/layers/detection_generator.py","lineNumber":1515,"sourceCode":"\n    decoded_results = {\n        'decoded_boxes': boxes,\n        'decoded_box_scores': scores,\n        'decoded_box_attributes': attributes,\n    }\n\n    if not self._config_dict['apply_nms']:\n      return decoded_results\n\n    # Optionally force the NMS to run on CPU.\n    if self._config_dict['use_cpu_nms']:\n      nms_context = tf.device('cpu:0')\n    else:\n      nms_context = contextlib.nullcontext()\n\n    with nms_context:\n      if raw_attributes and (self._config_dict['nms_version'] != 'v1'):\n        raise ValueError(\n            'Attribute learning is only supported for NMSv1 but NMS {} is used.'\n            .format(self._config_dict['nms_version'])\n        )\n      if self._config_dict['nms_version'] == 'batched':\n        (nmsed_boxes, nmsed_scores, nmsed_classes, valid_detections) = (\n            _generate_detections_batched(\n                boxes,\n                scores,\n                self._config_dict['pre_nms_score_threshold'],\n                self._config_dict['nms_iou_threshold'],\n                self._config_dict['max_num_detections'],\n            )\n        )\n        # Set `nmsed_attributes` to None for batched NMS.\n        nmsed_attributes = {}\n      elif self._config_dict['nms_version'] == 'v1':\n        (\n            nmsed_boxes,","sourceCodeStart":1497,"sourceCodeEnd":1533,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/layers/detection_generator.py#L1497-L1533","documentation":"Error \"Attribute learning is only supported for NMSv1 but NMS {} is used.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/layers/detection_generator.py:1515 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set nms_version to 1 when attribute learning is enabled.","Disable attribute learning heads if you need a different NMS version."],"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"}