tensorflow/models · error · ValueError
batch_size cannot be None for panoptic segmentation model.
Error message
batch_size cannot be None for panoptic segmentation model.
What it means
Error "batch_size cannot be None for panoptic segmentation model." thrown in tensorflow/models.
Source
Thrown at official/projects/panoptic/serving/panoptic_maskrcnn.py:39
from official.core import config_definitions as cfg
from official.projects.panoptic.modeling import panoptic_maskrcnn_model
from official.vision.serving import detection
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:View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/panoptic/serving/panoptic_maskrcnn.py:39 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/ac57b1a8155830cf.
Report an issue: GitHub.