henry000 commited on
Commit
0efc848
·
1 Parent(s): a44a5c1

⬆️ [Update] mAP from 0~1 to percentage

Browse files
yolo/tools/solver.py CHANGED
@@ -247,7 +247,7 @@ class ModelValidator:
247
  for mAP_key, mAP_val in mAP.items():
248
  mAPs[mAP_key].append(mAP_val)
249
 
250
- avg_mAPs = {key: torch.mean(torch.stack(val)) for key, val in mAPs.items()}
251
  self.progress.one_batch(avg_mAPs)
252
 
253
  predict_json.extend(predicts_to_json(img_paths, predicts, rev_tensor))
 
247
  for mAP_key, mAP_val in mAP.items():
248
  mAPs[mAP_key].append(mAP_val)
249
 
250
+ avg_mAPs = {key: 100 * torch.mean(torch.stack(val)) for key, val in mAPs.items()}
251
  self.progress.one_batch(avg_mAPs)
252
 
253
  predict_json.extend(predicts_to_json(img_paths, predicts, rev_tensor))
yolo/utils/logging_utils.py CHANGED
@@ -117,6 +117,7 @@ class ProgressLogger(Progress):
117
  @rank_check
118
  def start_train(self, num_epochs: int):
119
  self.task_epoch = self.add_task(f"[cyan]Start Training {num_epochs} epochs", total=num_epochs)
 
120
 
121
  @rank_check
122
  def start_one_epoch(
@@ -218,7 +219,7 @@ class ProgressLogger(Progress):
218
 
219
  @rank_check
220
  def finish_pycocotools(self, result, epoch_idx=-1):
221
- ap_table, ap_main = make_ap_table(result, self.ap_past_list, self.last_result, epoch_idx)
222
  self.last_result = np.maximum(result, self.last_result)
223
  self.ap_past_list.append((epoch_idx, ap_main))
224
  self.ap_table = ap_table
 
117
  @rank_check
118
  def start_train(self, num_epochs: int):
119
  self.task_epoch = self.add_task(f"[cyan]Start Training {num_epochs} epochs", total=num_epochs)
120
+ self.update(self.task_epoch, advance=-0.5)
121
 
122
  @rank_check
123
  def start_one_epoch(
 
219
 
220
  @rank_check
221
  def finish_pycocotools(self, result, epoch_idx=-1):
222
+ ap_table, ap_main = make_ap_table(result * 100, self.ap_past_list, self.last_result, epoch_idx)
223
  self.last_result = np.maximum(result, self.last_result)
224
  self.ap_past_list.append((epoch_idx, ap_main))
225
  self.ap_table = ap_table
yolo/utils/solver_utils.py CHANGED
@@ -21,9 +21,9 @@ def make_ap_table(score, past_result=[], last_score=None, epoch=-1):
21
  ap_table = Table()
22
  ap_table.add_column("Epoch", justify="center", style="white", width=5)
23
  ap_table.add_column("Avg. Precision", justify="left", style="cyan")
24
- ap_table.add_column("", justify="right", style="green", width=5)
25
  ap_table.add_column("Avg. Recall", justify="left", style="cyan")
26
- ap_table.add_column("", justify="right", style="green", width=5)
27
 
28
  for eps, (ap_name1, ap_color1, ap_value1, ap_name2, ap_color2, ap_value2) in past_result:
29
  ap_table.add_row(f"{eps: 3d}", ap_name1, f"{ap_color1}{ap_value1:.2f}", ap_name2, f"{ap_color2}{ap_value2:.2f}")
 
21
  ap_table = Table()
22
  ap_table.add_column("Epoch", justify="center", style="white", width=5)
23
  ap_table.add_column("Avg. Precision", justify="left", style="cyan")
24
+ ap_table.add_column("%", justify="right", style="green", width=5)
25
  ap_table.add_column("Avg. Recall", justify="left", style="cyan")
26
+ ap_table.add_column("%", justify="right", style="green", width=5)
27
 
28
  for eps, (ap_name1, ap_color1, ap_value1, ap_name2, ap_color2, ap_value2) in past_result:
29
  ap_table.add_row(f"{eps: 3d}", ap_name1, f"{ap_color1}{ap_value1:.2f}", ap_name2, f"{ap_color2}{ap_value2:.2f}")