tensorflow/models · error · ValueError

NMS version {} not supported.

Error message

NMS version {} not supported.

What it means

Error "NMS version {} not supported." thrown in tensorflow/models.

Source

Thrown at official/vision/modeling/layers/detection_generator.py:1102

                max_num_detections=self._config_dict['max_num_detections'],
                soft_nms_sigma=self._config_dict['soft_nms_sigma'],
            )
        )
      elif self._config_dict['nms_version'] == 'v2':
        (nmsed_boxes, nmsed_scores, nmsed_classes, valid_detections) = (
            _generate_detections_v2(
                decoded_boxes,
                box_scores,
                pre_nms_top_k=self._config_dict['pre_nms_top_k'],
                pre_nms_score_threshold=self._config_dict[
                    'pre_nms_score_threshold'
                ],
                nms_iou_threshold=self._config_dict['nms_iou_threshold'],
                max_num_detections=self._config_dict['max_num_detections'],
            )
        )
      else:
        raise ValueError(
            'NMS version {} not supported.'.format(
                self._config_dict['nms_version']
            )
        )

    # Adds 1 to offset the background class which has index 0.
    nmsed_classes += 1

    return {
        'num_detections': valid_detections,
        'detection_boxes': nmsed_boxes,
        'detection_classes': nmsed_classes,
        'detection_scores': nmsed_scores,
    }

  def get_config(self):
    return self._config_dict

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Use a supported NMS version: 1, 2, or the TFLite custom NMS option.
  2. Check the nms_version value in the detection generator config for typos.

When it happens

Trigger: Thrown at official/vision/modeling/layers/detection_generator.py:1102 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/20efab04ac084a2e. Report an issue: GitHub.