Add pred, export and val callbacks (#126)

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:
Ayush Chaurasia 2023-01-01 22:46:10 +05:30 committed by GitHub
parent 63c7a74691
commit c6eb6720de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 176 additions and 57 deletions

View file

@ -9,12 +9,11 @@ except (ImportError, AssertionError):
def on_pretrain_routine_start(trainer):
wandb.init(project=trainer.args.project if trainer.args.project != 'runs/train' else 'YOLOv8',
name=trainer.args.name,
config=dict(trainer.args)) if not wandb.run else wandb.run
wandb.init(project=trainer.args.project or "YOLOv8", name=trainer.args.name, config=dict(
trainer.args)) if not wandb.run else wandb.run
def on_val_end(trainer):
def on_fit_epoch_end(trainer):
wandb.run.log(trainer.metrics, step=trainer.epoch + 1)
if trainer.epoch == 0:
model_info = {
@ -42,5 +41,5 @@ def on_train_end(trainer):
callbacks = {
"on_pretrain_routine_start": on_pretrain_routine_start,
"on_train_epoch_end": on_train_epoch_end,
"on_val_end": on_val_end,
"on_fit_epoch_end": on_fit_epoch_end,
"on_train_end": on_train_end} if wandb else {}