Skip to content

Commit

Permalink
Infer Loggers project name (ultralytics#9117)
Browse files Browse the repository at this point in the history
* smart project name inference

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update __init__.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
3 people authored and Clay Januhowski committed Sep 8, 2022
1 parent 890da37 commit cd25fdd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion utils/loggers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def __init__(self, opt, console_logger, include=('tb', 'wandb')):
self.tb = SummaryWriter(str(self.save_dir))

if wandb and 'wandb' in self.include:
self.wandb = wandb.init(project="YOLOv5-Classifier" if opt.project == "runs/train" else opt.project,
self.wandb = wandb.init(project=web_project_name(str(opt.project)),
name=None if opt.name == "exp" else opt.name,
config=opt)
else:
Expand Down Expand Up @@ -303,3 +303,11 @@ def log_tensorboard_graph(tb, model, imgsz=(640, 640)):
tb.add_graph(torch.jit.trace(de_parallel(model), im, strict=False), [])
except Exception as e:
print(f'WARNING: TensorBoard graph visualization failure {e}')


def web_project_name(project):
# Convert local project name to web project name
if not project.startswith('runs/train'):
return project
suffix = '-Classify' if project.endswith('-cls') else '-Segment' if project.endswith('-seg') else ''
return f'YOLOv5{suffix}'

0 comments on commit cd25fdd

Please sign in to comment.