Fix indentation in `log_training_progress()` (#4126)
This commit is contained in:
parent
4bad914761
commit
4495e00016
|
|
@ -293,26 +293,26 @@ class WandbLogger():
|
||||||
return artifact
|
return artifact
|
||||||
|
|
||||||
def log_training_progress(self, predn, path, names):
|
def log_training_progress(self, predn, path, names):
|
||||||
class_set = wandb.Classes([{'id': id, 'name': name} for id, name in names.items()])
|
class_set = wandb.Classes([{'id': id, 'name': name} for id, name in names.items()])
|
||||||
box_data = []
|
box_data = []
|
||||||
total_conf = 0
|
total_conf = 0
|
||||||
for *xyxy, conf, cls in predn.tolist():
|
for *xyxy, conf, cls in predn.tolist():
|
||||||
if conf >= 0.25:
|
if conf >= 0.25:
|
||||||
box_data.append(
|
box_data.append(
|
||||||
{"position": {"minX": xyxy[0], "minY": xyxy[1], "maxX": xyxy[2], "maxY": xyxy[3]},
|
{"position": {"minX": xyxy[0], "minY": xyxy[1], "maxX": xyxy[2], "maxY": xyxy[3]},
|
||||||
"class_id": int(cls),
|
"class_id": int(cls),
|
||||||
"box_caption": "%s %.3f" % (names[cls], conf),
|
"box_caption": "%s %.3f" % (names[cls], conf),
|
||||||
"scores": {"class_score": conf},
|
"scores": {"class_score": conf},
|
||||||
"domain": "pixel"})
|
"domain": "pixel"})
|
||||||
total_conf = total_conf + conf
|
total_conf = total_conf + conf
|
||||||
boxes = {"predictions": {"box_data": box_data, "class_labels": names}} # inference-space
|
boxes = {"predictions": {"box_data": box_data, "class_labels": names}} # inference-space
|
||||||
id = self.val_table_path_map[Path(path).name]
|
id = self.val_table_path_map[Path(path).name]
|
||||||
self.result_table.add_data(self.current_epoch,
|
self.result_table.add_data(self.current_epoch,
|
||||||
id,
|
id,
|
||||||
self.val_table.data[id][1],
|
self.val_table.data[id][1],
|
||||||
wandb.Image(self.val_table.data[id][1], boxes=boxes, classes=class_set),
|
wandb.Image(self.val_table.data[id][1], boxes=boxes, classes=class_set),
|
||||||
total_conf / max(1, len(box_data))
|
total_conf / max(1, len(box_data))
|
||||||
)
|
)
|
||||||
|
|
||||||
def val_one_image(self, pred, predn, path, names, im):
|
def val_one_image(self, pred, predn, path, names, im):
|
||||||
if self.val_table and self.result_table: # Log Table if Val dataset is uploaded as artifact
|
if self.val_table and self.result_table: # Log Table if Val dataset is uploaded as artifact
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue