anomalib.utils.loggers.wandb¶
wandb logger with add image interface.
Module Contents¶
Classes¶
Logger for wandb. |
- class anomalib.utils.loggers.wandb.AnomalibWandbLogger(name: Optional[str] = None, save_dir: Optional[str] = None, offline: Optional[bool] = False, id: Optional[str] = None, anonymous: Optional[bool] = None, version: Optional[str] = None, project: Optional[str] = None, log_model: Union[str, bool] = False, experiment=None, prefix: Optional[str] = '', **kwargs)[source]¶
Bases:
anomalib.utils.loggers.base.ImageLoggerBase,pytorch_lightning.loggers.wandb.WandbLoggerLogger for wandb.
Adds interface for add_image in the logger rather than calling the experiment object.
Note
Same as the wandb Logger provided by PyTorch Lightning and the doc string is reproduced below.
Log using Weights and Biases.
Install it with pip:
$ pip install wandb
- Parameters
name – Display name for the run.
save_dir – Path where data is saved (wandb dir by default).
offline – Run offline (data can be streamed later to wandb servers).
id – Sets the version, mainly used to resume a previous run.
version – Same as id.
anonymous – Enables or explicitly disables anonymous logging.
project – The name of the project to which this run will belong.
log_model – Save checkpoints in wandb dir to upload on W&B servers.
prefix – A string to put at the beginning of metric keys.
experiment – WandB experiment object. Automatically set when creating a run.
**kwargs – Arguments passed to
wandb.init()like entity, group, tags, etc.
- Raises
ImportError – If required WandB package is not installed on the device.
MisconfigurationException – If both
log_modelandoffline``is set to ``True.
Example
>>> from anomalib.utils.loggers import AnomalibWandbLogger >>> from pytorch_lightning import Trainer >>> wandb_logger = AnomalibWandbLogger() >>> trainer = Trainer(logger=wandb_logger)
Note: When logging manually through wandb.log or trainer.logger.experiment.log, make sure to use commit=False so the logging step does not increase.
See also
Tutorial on how to use W&B with PyTorch Lightning