Infer Loggers project name (#9117)
* 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>
This commit is contained in:
1 file changed
+9
-1
@@ -252,7 +252,7 @@ class GenericLogger:
|
|||||||
self.tb = SummaryWriter(str(self.save_dir))
|
self.tb = SummaryWriter(str(self.save_dir))
|
||||||
|
|
||||||
if wandb and 'wandb' in self.include:
|
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,
|
name=None if opt.name == "exp" else opt.name,
|
||||||
config=opt)
|
config=opt)
|
||||||
else:
|
else:
|
||||||
@@ -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), [])
|
tb.add_graph(torch.jit.trace(de_parallel(model), im, strict=False), [])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'WARNING: TensorBoard graph visualization failure {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}'
|
||||||
Reference in new issue
Block a user