open-mmlab/mmdetection · info

The show is True, it means that only the prediction results

Error message

The show is True, it means that only the prediction results are visualized without storing data, so vis_backends needs to be excluded.

What it means

Warning from DetVisualizationHook.__init__: when show=True, the hook clears the visualizer's vis_backends (no writing to disk/local storage) because showing implies interactive display only.

Source

Thrown at mmdet/engine/hooks/visualization_hook.py:68

            corresponding backend. Defaults to None.
    """

    def __init__(self,
                 draw: bool = False,
                 interval: int = 50,
                 score_thr: float = 0.3,
                 show: bool = False,
                 wait_time: float = 0.,
                 test_out_dir: Optional[str] = None,
                 backend_args: dict = None):
        self._visualizer: Visualizer = Visualizer.get_current_instance()
        self.interval = interval
        self.score_thr = score_thr
        self.show = show
        if self.show:
            # No need to think about vis backends.
            self._visualizer._vis_backends = {}
            warnings.warn('The show is True, it means that only '
                          'the prediction results are visualized '
                          'without storing data, so vis_backends '
                          'needs to be excluded.')

        self.wait_time = wait_time
        self.backend_args = backend_args
        self.draw = draw
        self.test_out_dir = test_out_dir
        self._test_index = 0

    def after_val_iter(self, runner: Runner, batch_idx: int, data_batch: dict,
                       outputs: Sequence[DetDataSample]) -> None:
        """Run after every ``self.interval`` validation iterations.

        Args:
            runner (:obj:`Runner`): The runner of the validation process.
            batch_idx (int): The index of the current batch in the val loop.
            data_batch (dict): Data from dataloader.

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Set show=False if you want vis_backends to store images
  2. Remove show=True and rely on vis_backends for offline inspection
  3. If you want both, run twice or accept that show mode is display-only

Example fix

# before
custom_hooks = [dict(type='DetVisualizationHook', show=True)]
# after
custom_hooks = [dict(type='DetVisualizationHook', show=False)]
Defensive patterns

Strategy: validation

Validate before calling

if hook_cfg.get('show', False):
    assert not want_vis_backends, 'show=True disables all vis_backends'

Prevention

When it happens

Trigger: Configuring custom_hooks=[dict(type='DetVisualizationHook', show=True)] (or visualization=True + show=True in train cfg); all vis backends are dropped at hook init.

Common situations: Debugging on a display machine while config still lists Tensorboard/Local vis_backends; users wonder why no viz files appear during training.

Related errors


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