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

Error "Backbone min level should be less or equal to FPN min level" thrown in tensorflow/models.

Source

Thrown at official/vision/modeling/decoders/nasfpn.py:182

    # Repeatly builds the NAS-FPN modules.
    for _ in range(self._num_repeats):
      output_feats = self._build_feature_pyramid(feats)
      feats = [output_feats[level]
               for level in range(self._min_level, self._max_level + 1)]

    self._output_specs = {
        str(level): output_feats[level].get_shape()  # pyrefly: ignore[unbound-name]
        for level in range(min_level, max_level + 1)
    }
    output_feats = {str(level): output_feats[level]
                    for level in output_feats.keys()}  # pyrefly: ignore[unbound-name]
    super(NASFPN, self).__init__(inputs=inputs, outputs=output_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 _resample_feature_map(self,
                            inputs,
                            input_level,
                            target_level,
                            target_num_filters=256):
    x = inputs
    _, _, _, input_num_filters = x.get_shape().as_list()
    if input_num_filters != target_num_filters:
      x = self._conv_op(
          filters=target_num_filters,
          kernel_size=1,

View on GitHub (pinned to e006f5f0d5)

Solutions

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

When it happens

Trigger: Thrown at official/vision/modeling/decoders/nasfpn.py:182 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/c04f748751381f73. Report an issue: GitHub.