tensorflow/models · error · ValueError
An NMS algorithm is required for detection generator
Error message
An NMS algorithm is required for detection generator
What it means
Config check in generate_outputs: detection generation post-processing requires non-maximum suppression; when the configured detection_generator has apply_nms=False the pipeline cannot produce final boxes, so this ValueError is raised.
Solutions
- Enable apply_nms=True on the detection generator config
- Use a detection generator config that includes an NMS algorithm
- Disable generate_detections if raw outputs are all that is needed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/pointpillars/modeling/models.py:104 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/e891d2c4db193549.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/pointpillars/modeling/models.py:104
if image_shape is None:
raise ValueError('Image_shape should not be None for evaluation.')
if anchor_boxes is None:
# Generate anchors if needed.
anchor_boxes = utils.generate_anchors(
self._min_level,
self._max_level,
self._image_size,
self._anchor_sizes,
)
for l in anchor_boxes:
anchor_boxes[l] = tf.tile(
tf.expand_dims(anchor_boxes[l], axis=0),
[tf.shape(image_shape)[0], 1, 1, 1])
# Generate detected boxes.
if not self._detection_generator.get_config()['apply_nms']:
raise ValueError('An NMS algorithm is required for detection generator')
detections = self._detection_generator(raw_boxes, raw_scores,
anchor_boxes, image_shape,
raw_attributes)
outputs.update({
'boxes': detections['detection_boxes'],
'scores': detections['detection_scores'],
'classes': detections['detection_classes'],
'num_detections': detections['num_detections'],
'attributes': detections['detection_attributes'],
})
return outputs
def call(self, # pytype: disable=annotation-type-mismatch,signature-mismatch
pillars: tf.Tensor,
indices: tf.Tensor,
image_shape: Optional[tf.Tensor] = None,
anchor_boxes: Optional[Mapping[str, tf.Tensor]] = None,
training: bool = None) -> Mapping[str, Any]: # pyrefly: ignore[bad-function-definition]View on GitHub (pinned to e006f5f0d5)