{"record":{"id":"ac57b1a8155830cf","repo":"tensorflow/models","slug":"batch-size-cannot-be-none-for-panoptic-segmentatio-ac57b1","errorCode":null,"errorMessage":"batch_size cannot be None for panoptic segmentation model.","messagePattern":"batch_size cannot be None for panoptic segmentation model\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/panoptic/serving/panoptic_maskrcnn.py","lineNumber":39,"sourceCode":"from official.core import config_definitions as cfg\nfrom official.projects.panoptic.modeling import panoptic_maskrcnn_model\nfrom official.vision.serving import detection\n\n\nclass PanopticSegmentationModule(detection.DetectionModule):\n  \"\"\"Panoptic Segmentation Module.\"\"\"\n\n  def __init__(self,\n               params: cfg.ExperimentConfig,\n               *,\n               model: tf_keras.Model,\n               batch_size: int,\n               input_image_size: List[int],\n               num_channels: int = 3):\n    \"\"\"Initializes panoptic segmentation module for export.\"\"\"\n\n    if batch_size is None:\n      raise ValueError('batch_size cannot be None for panoptic segmentation '\n                       'model.')\n    if not isinstance(model, panoptic_maskrcnn_model.PanopticMaskRCNNModel):\n      raise ValueError('PanopticSegmentationModule module not implemented for '\n                       '{} model.'.format(type(model)))\n\n    super().__init__(\n        params=params,\n        model=model,\n        batch_size=batch_size,\n        input_image_size=input_image_size,\n        num_channels=num_channels)\n\n  def serve(self, images: tf.Tensor):\n    \"\"\"Casts image to float and run inference.\n\n    Args:\n      images: uint8 Tensor of shape [batch_size, None, None, 3]\n    Returns:","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/panoptic/serving/panoptic_maskrcnn.py#L21-L57","documentation":"Error \"batch_size cannot be None for panoptic segmentation model.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/panoptic/serving/panoptic_maskrcnn.py:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}