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

🐞 Fix linting issues #535

Merged
merged 2 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion anomalib/utils/callbacks/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from pytorch_lightning import Callback, LightningModule, Trainer
from pytorch_lightning.utilities.cli import CALLBACK_REGISTRY

from anomalib.utils.loggers import AnomalibTensorBoardLogger, AnomalibWandbLogger, AnomalibCometLogger
from anomalib.utils.loggers import (
AnomalibCometLogger,
AnomalibTensorBoardLogger,
AnomalibWandbLogger,
)


@CALLBACK_REGISTRY
Expand Down
10 changes: 3 additions & 7 deletions anomalib/utils/loggers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
from omegaconf.listconfig import ListConfig
from pytorch_lightning.loggers import CSVLogger, LightningLoggerBase

from .comet import AnomalibCometLogger
from .tensorboard import AnomalibTensorBoardLogger
from .wandb import AnomalibWandbLogger
from .comet import AnomalibCometLogger

__all__ = [
"AnomalibCometLogger",
Expand Down Expand Up @@ -116,7 +116,7 @@ def get_experiment_logger(
save_dir=wandb_logdir,
)
)
elif experiment_logger=="comet":
elif experiment_logger == "comet":
comet_logdir = os.path.join(config.project.path, "logs")
os.makedirs(comet_logdir, exist_ok=True)
run_name = (
Expand All @@ -125,11 +125,7 @@ def get_experiment_logger(
else f"{config.dataset.category} {config.model.name}"
)
logger_list.append(
AnomalibCometLogger(
project_name=config.dataset.name,
experiment_name=run_name,
save_dir=comet_logdir
)
AnomalibCometLogger(project_name=config.dataset.name, experiment_name=run_name, save_dir=comet_logdir)
)
elif experiment_logger == "csv":
logger_list.append(CSVLogger(save_dir=os.path.join(config.project.path, "logs")))
Expand Down
1 change: 0 additions & 1 deletion anomalib/utils/loggers/comet.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from pytorch_lightning.loggers.comet import CometLogger
from pytorch_lightning.utilities import rank_zero_only


from .base import ImageLoggerBase


Expand Down
20 changes: 10 additions & 10 deletions docs/blog/001-train-custom-dataset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,16 @@ To use TensorBoard and/or W&B logger and/or Comet logger, ensure that the logger
An example configuration for saving to TensorBoard is shown in the figure below. Similarly after setting logger to `wandb` or 'comet' you will see the images on your wandb and/or comet project dashboard.

```yaml
visualization:
show_images: False # show images on the screen
save_images: False # save images to the file system
log_images: True # log images to the available loggers (if any)
image_save_path: null # path to which images will be saved
mode: full # options: ["full", "simple"]

logging:
logger: [comet, tensorboard, wandb] #Choose any combination of these 3
log_graph: false
visualization:
show_images: False # show images on the screen
save_images: False # save images to the file system
log_images: True # log images to the available loggers (if any)
image_save_path: null # path to which images will be saved
mode: full # options: ["full", "simple"]

logging:
logger: [comet, tensorboard, wandb] #Choose any combination of these 3
log_graph: false
```

<div align="center">
Expand Down
4 changes: 2 additions & 2 deletions tests/pre_merge/utils/loggers/test_get_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from pytorch_lightning.loggers import CSVLogger

from anomalib.utils.loggers import (
AnomalibCometLogger,
AnomalibTensorBoardLogger,
AnomalibWandbLogger,
AnomalibCometLogger,
UnknownLogger,
get_experiment_logger,
)
Expand Down Expand Up @@ -51,7 +51,7 @@ def test_get_experiment_logger():
logger = get_experiment_logger(config=config)
assert isinstance(logger[0], AnomalibWandbLogger)

# get comet logger
# get comet logger
config.project.logger = "comet"
logger = get_experiment_logger(config=config)
assert isinstance(logger[0], AnomalibCometLogger)
Expand Down