Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WandbVisBackend #1502

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions mmengine/visualization/vis_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import warnings
from abc import ABCMeta, abstractmethod
from collections.abc import MutableMapping
from typing import Any, Callable, List, Optional, Sequence, Union
from typing import Any, Callable, Dict, List, Optional, Sequence, Union

import cv2
import numpy as np
Expand Down Expand Up @@ -456,6 +456,8 @@ def add_graph(self, model: torch.nn.Module, data_batch: Sequence[dict],
def add_image(self,
name: str,
image: np.ndarray,
boxes: Optional[Dict] = None,
masks: Optional[Dict] = None,
step: int = 0,
**kwargs) -> None:
"""Record the image to wandb.
Expand All @@ -467,7 +469,7 @@ def add_image(self,
step (int): Useless parameter. Wandb does not
need this parameter. Defaults to 0.
"""
image = self._wandb.Image(image)
image = self._wandb.Image(image, boxes=boxes, masks=masks)
self._wandb.log({name: image}, commit=self._commit)

@force_init_env
Expand Down Expand Up @@ -507,7 +509,7 @@ def add_scalars(self,
def close(self) -> None:
"""close an opened wandb object."""
if hasattr(self, '_wandb'):
self._wandb.join()
self._wandb.finish()


@VISBACKENDS.register_module()
Expand Down