tensorflow/models · error · ValueError
Attribute learning is only supported for NMSv1 but NMS {} is
Error message
Attribute learning is only supported for NMSv1 but NMS {} is used. What it means
Error "Attribute learning is only supported for NMSv1 but NMS {} is used." thrown in tensorflow/models.
Source
Thrown at official/vision/modeling/layers/detection_generator.py:1515
decoded_results = {
'decoded_boxes': boxes,
'decoded_box_scores': scores,
'decoded_box_attributes': attributes,
}
if not self._config_dict['apply_nms']:
return decoded_results
# Optionally force the NMS to run on CPU.
if self._config_dict['use_cpu_nms']:
nms_context = tf.device('cpu:0')
else:
nms_context = contextlib.nullcontext()
with nms_context:
if raw_attributes and (self._config_dict['nms_version'] != 'v1'):
raise ValueError(
'Attribute learning is only supported for NMSv1 but NMS {} is used.'
.format(self._config_dict['nms_version'])
)
if self._config_dict['nms_version'] == 'batched':
(nmsed_boxes, nmsed_scores, nmsed_classes, valid_detections) = (
_generate_detections_batched(
boxes,
scores,
self._config_dict['pre_nms_score_threshold'],
self._config_dict['nms_iou_threshold'],
self._config_dict['max_num_detections'],
)
)
# Set `nmsed_attributes` to None for batched NMS.
nmsed_attributes = {}
elif self._config_dict['nms_version'] == 'v1':
(
nmsed_boxes,View on GitHub (pinned to e006f5f0d5)
Solutions
- Set nms_version to 1 when attribute learning is enabled.
- Disable attribute learning heads if you need a different NMS version.
When it happens
Trigger: Thrown at official/vision/modeling/layers/detection_generator.py:1515 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/0fad7f4e214e774b.
Report an issue: GitHub.