tensorflow/models · error · ValueError

Backbone min level should be less or equal to FPN min level

Error message

Backbone min level should be less or equal to FPN min level

What it means

Raised in FPN._build_input_pyramid when the backbone's minimum level is higher than the FPN's minimum level; the FPN cannot source features for its lowest levels.

Solutions

  1. Set the backbone min_level to a value less than or equal to the FPN min_level.
  2. Adjust the FPN min_level/max_level or the backbone levels so the ranges are compatible.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/vision/modeling/decoders/fpn.py:199 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/1caca25e6948a454. Report an issue: GitHub.

Appendix: source

Thrown at official/vision/modeling/decoders/fpn.py:199

          axis=bn_axis,
          momentum=norm_momentum,
          epsilon=norm_epsilon,
          synchronized=use_sync_bn,
          name=f'norm_{level}')(
              feats[str(level)])

    self._output_specs = {
        str(level): feats[str(level)].get_shape()
        for level in range(min_level, max_level + 1)
    }

    super().__init__(inputs=inputs, outputs=feats, **kwargs)

  def _build_input_pyramid(self, input_specs: Mapping[str, tf.TensorShape],
                           min_level: int):
    assert isinstance(input_specs, dict)
    if min(input_specs.keys()) > str(min_level):
      raise ValueError(
          'Backbone min level should be less or equal to FPN min level')

    inputs = {}
    for level, spec in input_specs.items():
      inputs[level] = tf_keras.Input(shape=spec[1:])
    return inputs

  def get_config(self) -> Mapping[str, Any]:
    return self._config_dict

  @classmethod
  def from_config(cls, config, custom_objects=None):
    return cls(**config)

  @property
  def output_specs(self) -> Mapping[str, tf.TensorShape]:
    """A dict of {level: TensorShape} pairs for the model output."""
    return self._output_specs

View on GitHub (pinned to e006f5f0d5)