tensorflow/models · error · NotImplementedError

Unimplemented eval_metrics

Error message

Unimplemented eval_metrics

What it means

BaseModel.eval_metrics is an abstract hook: the base class intentionally raises NotImplementedError to force every detection model subclass to define its own evaluation metrics. Hitting it means a model class failed to override eval_metrics.

Solutions

  1. Implement eval_metrics() in your model subclass returning the metric functions tuple
  2. Instantiate a concrete model (RetinanetModel, MaskrcnnModel, etc.) that already overrides eval_metrics
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/legacy/detection/modeling/base_model.py:135 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/9d353476c084242f. Report an issue: GitHub.

Appendix: source

Thrown at official/legacy/detection/modeling/base_model.py:135

    ]

    return self._l2_weight_decay * tf.add_n(
        [tf.nn.l2_loss(v) for v in reg_variables])

  def make_restore_checkpoint_fn(self):
    """Returns scaffold function to restore parameters from v1 checkpoint."""
    if 'skip_checkpoint_variables' in self._checkpoint:
      skip_regex = self._checkpoint['skip_checkpoint_variables']
    else:
      skip_regex = None
    return checkpoint_utils.make_restore_checkpoint_fn(
        self._checkpoint['path'],
        prefix=self._checkpoint['prefix'],
        skip_regex=skip_regex)

  def eval_metrics(self):
    """Returns tuple of metric function and its inputs for evaluation."""
    raise NotImplementedError('Unimplemented eval_metrics')

View on GitHub (pinned to e006f5f0d5)