tensorflow/models · error · ValueError

Inconsistent decoder type {decoder_type}. Need to be `fpn`.

Error message

Inconsistent decoder type {decoder_type}. Need to be `fpn`.

What it means

Error "Inconsistent decoder type {decoder_type}. Need to be `fpn`." thrown in tensorflow/models.

Source

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

  """Builds FPN decoder from a config.

  Args:
    input_specs: A `dict` of input specifications. A dictionary consists of
      {level: TensorShape} from a backbone.
    model_config: A OneOfConfig. Model config.
    l2_regularizer: A `tf_keras.regularizers.Regularizer` instance. Default to
      None.

  Returns:
    A `tf_keras.Model` instance of the FPN decoder.

  Raises:
    ValueError: If the model_config.decoder.type is not `fpn`.
  """
  decoder_type = model_config.decoder.type
  decoder_cfg = model_config.decoder.get()
  if decoder_type != 'fpn':
    raise ValueError(f'Inconsistent decoder type {decoder_type}. '
                     'Need to be `fpn`.')
  norm_activation_config = model_config.norm_activation
  return FPN(
      input_specs=input_specs,
      min_level=model_config.min_level,
      max_level=model_config.max_level,
      num_filters=decoder_cfg.num_filters,
      fusion_type=decoder_cfg.fusion_type,
      use_separable_conv=decoder_cfg.use_separable_conv,
      use_keras_layer=decoder_cfg.use_keras_layer,
      activation=norm_activation_config.activation,
      use_sync_bn=norm_activation_config.use_sync_bn,
      norm_momentum=norm_activation_config.norm_momentum,
      norm_epsilon=norm_activation_config.norm_epsilon,
      kernel_regularizer=l2_regularizer)

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Set the decoder type to 'fpn' when building an FPN decoder.
  2. Use the matching factory/config class so the decoder type is consistent.

When it happens

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