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: Glenn Jocher <glenn.jocher@ultralytics.com>pull/1279/head
parent
2062765e06
commit
96fcde40b8
14
test.py
14
test.py
|
@ -95,7 +95,7 @@ def test(data,
|
|||
hyp=None, augment=False, cache=False, pad=0.5, rect=True)[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()
|
||||
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.
|
||||
|
@ -150,11 +150,13 @@ def test(data,
|
|||
|
||||
# W&B logging
|
||||
if len(wandb_images) < log_imgs:
|
||||
bbox_data = [{"position": {"minX": xyxy[0], "minY": xyxy[1], "maxX": xyxy[2], "maxY": xyxy[3]},
|
||||
"class_id": int(cls),
|
||||
"scores": {"class_score": conf},
|
||||
"domain": "pixel"} for *xyxy, conf, cls in pred.clone().tolist()]
|
||||
wandb_images.append(wandb.Image(img[si], boxes={"predictions": {"box_data": bbox_data}}))
|
||||
box_data = [{"position": {"minX": xyxy[0], "minY": xyxy[1], "maxX": xyxy[2], "maxY": xyxy[3]},
|
||||
"class_id": int(cls),
|
||||
"box_caption": "%s %.3f" % (names[cls], conf),
|
||||
"scores": {"class_score": conf},
|
||||
"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_coords(pred, (height, width))
|
||||
|
|
2
train.py
2
train.py
|
@ -121,7 +121,7 @@ def train(hyp, opt, device, tb_writer=None, wandb=None):
|
|||
# Logging
|
||||
if wandb and wandb.run is 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
|
||||
start_epoch, best_fitness = 0, 0.0
|
||||
|
|
Loading…
Reference in New Issue