tensorflow/models · error · ValueError

PanopticSegmentationModule module not implemented for

Error message

PanopticSegmentationModule module not implemented for {} model.

What it means

Raised in panoptic_maskrcnn.PanopticSegmentationModule.__init__ when the provided model is not a PanopticMaskRCNNModel instance; this module only supports the panoptic Mask R-CNN architecture.

Solutions

  1. Build the model with factory.build_panoptic_maskrcnn before export
  2. Use the panoptic_deeplab serving module for Panoptic Deeplab models
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at official/projects/panoptic/serving/panoptic_maskrcnn.py:42 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/7b3c0b4c11c73df8. Report an issue: GitHub.

Appendix: source

Thrown at official/projects/panoptic/serving/panoptic_maskrcnn.py:42


class PanopticSegmentationModule(detection.DetectionModule):
  """Panoptic Segmentation Module."""

  def __init__(self,
               params: cfg.ExperimentConfig,
               *,
               model: tf_keras.Model,
               batch_size: int,
               input_image_size: List[int],
               num_channels: int = 3):
    """Initializes panoptic segmentation module for export."""

    if batch_size is None:
      raise ValueError('batch_size cannot be None for panoptic segmentation '
                       'model.')
    if not isinstance(model, panoptic_maskrcnn_model.PanopticMaskRCNNModel):
      raise ValueError('PanopticSegmentationModule module not implemented for '
                       '{} model.'.format(type(model)))

    super().__init__(
        params=params,
        model=model,
        batch_size=batch_size,
        input_image_size=input_image_size,
        num_channels=num_channels)

  def serve(self, images: tf.Tensor):
    """Casts image to float and run inference.

    Args:
      images: uint8 Tensor of shape [batch_size, None, None, 3]
    Returns:
      Tensor holding detection output logits.
    """
    model_params = self.params.task.model

View on GitHub (pinned to e006f5f0d5)