{"record":{"id":"b6b717981d42d9b2","repo":"tensorflow/models","slug":"batch-size-cannot-be-none-for-panoptic-segmentatio","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_deeplab.py","lineNumber":41,"sourceCode":"from official.projects.panoptic.modeling import panoptic_deeplab_model\nfrom official.vision.serving import semantic_segmentation\n\n\nclass PanopticSegmentationModule(\n    semantic_segmentation.SegmentationModule):\n  \"\"\"Panoptic Deeplab 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_deeplab_model.PanopticDeeplabModel):\n      raise ValueError('PanopticSegmentationModule module not '\n                       'implemented for {} model.'.format(type(model)))\n    params.task.train_data.preserve_aspect_ratio = True\n    super(PanopticSegmentationModule, self).__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 _build_model(self):\n    input_specs = tf_keras.layers.InputSpec(shape=[self._batch_size] +\n                                            self._input_image_size + [3])\n\n    return factory.build_panoptic_deeplab(\n        input_specs=input_specs,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/panoptic/serving/panoptic_deeplab.py#L23-L59","documentation":"Error \"batch_size cannot be None for panoptic segmentation model.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/panoptic/serving/panoptic_deeplab.py:41 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"}