tensorflow/models · error · ValueError

The min_level should be >= decoder output level, but

Error message

The min_level should be >= decoder output level, but {} < {}

What it means

Consistency check in SSDHead.build: the head's min_level must be at or below the decoder's output level, otherwise the head would request feature maps the decoder never produces; build() compares against input_specs and raises this ValueError on mismatch.

Solutions

  1. Align the head's min_level with the decoder's output level in the model config
  2. Ensure the decoder and head configs come from the same experiment family
  3. Print the decoder output levels from input_specs and set min_level accordingly
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/projects/pointpillars/modeling/heads.py:76 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/57326c688e06d89d. Report an issue: GitHub.

Appendix: source

Thrown at official/projects/pointpillars/modeling/heads.py:76

      output_specs: A dict of {level: TensorShape} pairs for the model output.
    """
    super(SSDHead, self).__init__(**kwargs)
    self._config_dict = {
        'num_classes': num_classes,
        'num_anchors_per_location': num_anchors_per_location,
        'num_params_per_anchor': num_params_per_anchor,
        'attribute_heads': attribute_heads,
        'min_level': min_level,
        'max_level': max_level,
        'kernel_regularizer': kernel_regularizer,
    }

    utils.assert_channels_last()

  def build(self, input_specs: Mapping[str, tf.TensorShape]):
    self._decoder_output_level = int(min(input_specs.keys()))
    if self._config_dict['min_level'] < self._decoder_output_level:
      raise ValueError('The min_level should be >= decoder output '
                       'level, but {} < {}'.format(
                           self._config_dict['min_level'],
                           self._decoder_output_level))

    # Multi-level convs.
    # Set num_filters as the one of decoder's output level.
    num_filters = input_specs[str(self._decoder_output_level)].as_list()[-1]
    self._convs = {}
    for level in range(self._decoder_output_level + 1,
                       self._config_dict['max_level'] + 1):
      self._convs[str(level)] = layers.ConvBlock(
          filters=num_filters,
          kernel_size=3,
          strides=2,
          kernel_regularizer=self._config_dict['kernel_regularizer'])

    # Detection convs, share weights across multi levels.
    self._classifier = tf_keras.layers.Conv2D(

View on GitHub (pinned to e006f5f0d5)