henry000 commited on
Commit
9dfa178
Β·
1 Parent(s): b2baf14

πŸ”Š [Update] logs to meet the inference stage

Browse files
Files changed (1) hide show
  1. yolo/utils/logging_utils.py +5 -2
yolo/utils/logging_utils.py CHANGED
@@ -56,7 +56,7 @@ class ProgressTracker:
56
  def start_train(self, num_epochs: int):
57
  self.task_epoch = self.progress.add_task("[cyan]Epochs [white]| Loss | Box | DFL | BCE |", total=num_epochs)
58
 
59
- def start_one_epoch(self, num_batches: int, optimizer: Optimizer, epoch_idx: int):
60
  self.num_batches = num_batches
61
  if self.use_wandb:
62
  lr_values = [params["lr"] for params in optimizer.param_groups]
@@ -65,7 +65,10 @@ class ProgressTracker:
65
  self.wandb.log({f"Learning Rate/{lr_name}": lr_value}, step=epoch_idx)
66
  self.batch_task = self.progress.add_task("[green]Batches", total=num_batches)
67
 
68
- def one_batch(self, loss_dict: Dict[str, Tensor]):
 
 
 
69
  if self.use_wandb:
70
  for loss_name, loss_value in loss_dict.items():
71
  self.wandb.log({f"Loss/{loss_name}": loss_value})
 
56
  def start_train(self, num_epochs: int):
57
  self.task_epoch = self.progress.add_task("[cyan]Epochs [white]| Loss | Box | DFL | BCE |", total=num_epochs)
58
 
59
+ def start_one_epoch(self, num_batches: int, optimizer: Optimizer = None, epoch_idx: int = None):
60
  self.num_batches = num_batches
61
  if self.use_wandb:
62
  lr_values = [params["lr"] for params in optimizer.param_groups]
 
65
  self.wandb.log({f"Learning Rate/{lr_name}": lr_value}, step=epoch_idx)
66
  self.batch_task = self.progress.add_task("[green]Batches", total=num_batches)
67
 
68
+ def one_batch(self, loss_dict: Dict[str, Tensor] = None, mapp=None):
69
+ if loss_dict is None:
70
+ self.progress.update(self.batch_task, advance=1, description=f"[green]Batches [white]{mapp:.2%}")
71
+ return
72
  if self.use_wandb:
73
  for loss_name, loss_value in loss_dict.items():
74
  self.wandb.log({f"Loss/{loss_name}": loss_value})