Unverified 提交 96fcde40 authored 作者: Ayush Chaurasia's avatar Ayush Chaurasia 提交者: GitHub

W&B feature improvements (#1258)

* W&B feature improvements This PR add: * Class to id labels. Now, the caption of bounding boxes will display the class name and the class confidence score. * The project name is set to "Yolov5" and the run name will be set to opt.logdir * cleanup * remove parenthesis on caption Co-authored-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com>
上级 2062765e
...@@ -95,7 +95,7 @@ def test(data, ...@@ -95,7 +95,7 @@ def test(data,
hyp=None, augment=False, cache=False, pad=0.5, rect=True)[0] hyp=None, augment=False, cache=False, pad=0.5, rect=True)[0]
seen = 0 seen = 0
names = model.names if hasattr(model, 'names') else model.module.names names = {k: v for k, v in enumerate(model.names if hasattr(model, 'names') else model.module.names)}
coco91class = coco80_to_coco91_class() coco91class = coco80_to_coco91_class()
s = ('%20s' + '%12s' * 6) % ('Class', 'Images', 'Targets', 'P', 'R', 'mAP@.5', 'mAP@.5:.95') s = ('%20s' + '%12s' * 6) % ('Class', 'Images', 'Targets', 'P', 'R', 'mAP@.5', 'mAP@.5:.95')
p, r, f1, mp, mr, map50, map, t0, t1 = 0., 0., 0., 0., 0., 0., 0., 0., 0. p, r, f1, mp, mr, map50, map, t0, t1 = 0., 0., 0., 0., 0., 0., 0., 0., 0.
...@@ -150,11 +150,13 @@ def test(data, ...@@ -150,11 +150,13 @@ def test(data,
# W&B logging # W&B logging
if len(wandb_images) < log_imgs: if len(wandb_images) < log_imgs:
bbox_data = [{"position": {"minX": xyxy[0], "minY": xyxy[1], "maxX": xyxy[2], "maxY": xyxy[3]}, box_data = [{"position": {"minX": xyxy[0], "minY": xyxy[1], "maxX": xyxy[2], "maxY": xyxy[3]},
"class_id": int(cls), "class_id": int(cls),
"scores": {"class_score": conf}, "box_caption": "%s %.3f" % (names[cls], conf),
"domain": "pixel"} for *xyxy, conf, cls in pred.clone().tolist()] "scores": {"class_score": conf},
wandb_images.append(wandb.Image(img[si], boxes={"predictions": {"box_data": bbox_data}})) "domain": "pixel"} for *xyxy, conf, cls in pred.clone().tolist()]
boxes = {"predictions": {"box_data": box_data, "class_labels": names}}
wandb_images.append(wandb.Image(img[si], boxes=boxes))
# Clip boxes to image bounds # Clip boxes to image bounds
clip_coords(pred, (height, width)) clip_coords(pred, (height, width))
......
...@@ -121,7 +121,7 @@ def train(hyp, opt, device, tb_writer=None, wandb=None): ...@@ -121,7 +121,7 @@ def train(hyp, opt, device, tb_writer=None, wandb=None):
# Logging # Logging
if wandb and wandb.run is None: if wandb and wandb.run is None:
id = ckpt.get('wandb_id') if 'ckpt' in locals() else None id = ckpt.get('wandb_id') if 'ckpt' in locals() else None
wandb_run = wandb.init(config=opt, resume="allow", project=os.path.basename(log_dir), id=id) wandb_run = wandb.init(config=opt, resume="allow", project="YOLOv5", name=os.path.basename(log_dir), id=id)
# Resume # Resume
start_epoch, best_fitness = 0, 0.0 start_epoch, best_fitness = 0, 0.0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论