Skip to content

Commit

Permalink
[Bugfix] Allow custom visualizer (#3455)
Browse files Browse the repository at this point in the history
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.

## Motivation

Current Visualization Hook can only get instances of
`SegLocalVisualizer`. This makes impossible to use any other custom
implementation.

## Modification

This PR just allows to instantiate a different visualizer (following
mmdetection implementation):

https://github.com/open-mmlab/mmdetection/blob/main/mmdet/engine/hooks/visualization_hook.py#L58
  • Loading branch information
mmeendez8 committed Dec 4, 2023
1 parent e51f511 commit 83bff18
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mmseg/engine/hooks/visualization_hook.py
Expand Up @@ -7,10 +7,10 @@
import mmengine.fileio as fileio
from mmengine.hooks import Hook
from mmengine.runner import Runner
from mmengine.visualization import Visualizer

from mmseg.registry import HOOKS
from mmseg.structures import SegDataSample
from mmseg.visualization import SegLocalVisualizer


@HOOKS.register_module()
Expand Down Expand Up @@ -42,8 +42,7 @@ def __init__(self,
show: bool = False,
wait_time: float = 0.,
backend_args: Optional[dict] = None):
self._visualizer: SegLocalVisualizer = \
SegLocalVisualizer.get_current_instance()
self._visualizer: Visualizer = Visualizer.get_current_instance()
self.interval = interval
self.show = show
if self.show:
Expand Down

0 comments on commit 83bff18

Please sign in to comment.