tensorflow/models · error · ValueError

target_level should be less than max_level

Error message

target_level should be less than max_level

What it means

Error "target_level should be less than max_level" thrown in tensorflow/models.

Source

Thrown at official/vision/modeling/layers/nn_layers.py:341

    """Initializes panoptic FPN feature fusion layer.

    Args:
      min_level: An `int` of minimum level to use in feature fusion.
      max_level: An `int` of maximum level to use in feature fusion.
      target_level: An `int` of the target feature level for feature fusion.
      num_filters: An `int` number of filters in conv2d layers.
      num_fpn_filters: An `int` number of filters in the FPN outputs
      activation: A `str` name of the activation function.
      kernel_regularizer: A `tf_keras.regularizers.Regularizer` object for
        Conv2D. Default is None.
      bias_regularizer: A `tf_keras.regularizers.Regularizer` object for Conv2D.
      **kwargs: Additional keyword arguments to be passed.
    Returns:
      A `float` `tf.Tensor` of shape [batch_size, feature_height, feature_width,
        feature_channel].
    """
    if target_level > max_level:
      raise ValueError('target_level should be less than max_level')

    self._config_dict = {
        'min_level': min_level,
        'max_level': max_level,
        'target_level': target_level,
        'num_filters': num_filters,
        'num_fpn_filters': num_fpn_filters,
        'activation': activation,
        'kernel_regularizer': kernel_regularizer,
        'bias_regularizer': bias_regularizer,
    }
    norm = tf_keras.layers.GroupNormalization
    conv2d = tf_keras.layers.Conv2D
    activation_fn = tf_utils.get_activation(activation)
    if tf_keras.backend.image_data_format() == 'channels_last':
      norm_axis = -1
    else:
      norm_axis = 1

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Set target_level to a level lower than max_level.
  2. Adjust min_level/max_level or target_level in the config so target_level < max_level.

When it happens

Trigger: Thrown at official/vision/modeling/layers/nn_layers.py:341 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/64cc783b00a7d8aa. Report an issue: GitHub.