open-mmlab/mmdetection · warning

Panoptic segmentation map will not be compressed. The dumped

Error message

Panoptic segmentation map will not be compressed. The dumped file will be extremely large! Suggest using `CocoPanopticMetric` to save the coco format json and segmentation png files directly.

What it means

DumpDetResults.process() warns when a data sample contains pred_panoptic_seg: panoptic segmentation maps are stored as uncompressed label maps, so the dumped pickle will be extremely large. The warning suggests using CocoPanopticMetric which writes COCO-format JSON plus compressed PNG segmentations instead.

Source

Thrown at mmdet/evaluation/metrics/dump_det_results.py:42

            'gpu'. Defaults to 'cpu'.
    """

    def process(self, data_batch: dict, data_samples: Sequence[dict]) -> None:
        """transfer tensors in predictions to CPU."""
        data_samples = _to_cpu(data_samples)
        for data_sample in data_samples:
            # remove gt
            data_sample.pop('gt_instances', None)
            data_sample.pop('ignored_instances', None)
            data_sample.pop('gt_panoptic_seg', None)

            if 'pred_instances' in data_sample:
                pred = data_sample['pred_instances']
                # encode mask to RLE
                if 'masks' in pred:
                    pred['masks'] = encode_mask_results(pred['masks'].numpy())
            if 'pred_panoptic_seg' in data_sample:
                warnings.warn(
                    'Panoptic segmentation map will not be compressed. '
                    'The dumped file will be extremely large! '
                    'Suggest using `CocoPanopticMetric` to save the coco '
                    'format json and segmentation png files directly.')
        self.results.extend(data_samples)

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Use CocoPanopticMetric with outfile_prefix to dump COCO-format JSON and PNG files instead
  2. If you truly need raw dumps, accept the large file and ensure ample disk space
  3. Post-process: convert panoptic maps to compressed PNG after dumping instead of storing raw arrays

Example fix

# before
val_evaluator = dict(type='DumpDetResults', outfile_path='results.pkl')
# after
val_evaluator = dict(type='CocoPanopticMetric', outfile_prefix='results')
Defensive patterns

Strategy: fallback

Validate before calling

has_panoptic = any('pred_panoptic_seg' in s for s in data_samples)
if has_panoptic:
    # prefer CocoPanopticMetric over DumpDetResults
    ...

Prevention

When it happens

Trigger: Running evaluation with DumpDetResults(outfile_path=...) on a panoptic segmentation model; any sample with a 'pred_panoptic_seg' key triggers the warning during process().

Common situations: Users swap val_evaluator to DumpDetResults for offline analysis of a panoptic model (e.g. Panoptic FPN) and get multi-GB pickle files.

Related errors


AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27). Data as JSON: /api/errors/80bf53406533176e. Report an issue: GitHub.