From f4ed2f799ebf550436e69ecc834d3159c998f775 Mon Sep 17 00:00:00 2001 From: Laurent Fainsin Date: Thu, 30 Jun 2022 11:44:39 +0200 Subject: [PATCH] revert: want back to table display for predictions Former-commit-id: 2af16f486ffeaca232aee35d360fe75e78adfc9e [formerly e072ee4b33587b45f6c6c34f809b9638a9e0b569] Former-commit-id: 69c874da0fbe6e2a5cb2421fa20ffb9c34b36fc1 --- src/evaluate.py | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/src/evaluate.py b/src/evaluate.py index 3811d14..cf39e98 100644 --- a/src/evaluate.py +++ b/src/evaluate.py @@ -34,28 +34,10 @@ def evaluate(net, dataloader, device): pbar.update(images.shape[0]) # save some images to wandb - overlays = [] - for img, mask, pred in zip(images.to("cpu"), masks_true.to("cpu"), masks_pred.to("cpu")): - mask_img = np.asarray(mask > 0.5, np.uint8).squeeze(0) # tester des trucs sans le threshold - pred_img = np.asarray(pred > 0.5, np.uint8).squeeze(0) - - overlays.append( - wandb.Image( - img, - masks={ - "ground_truth": { - "mask_data": mask_img, - "class_labels": class_labels, - }, - "predictions": { - "mask_data": pred_img, - "class_labels": class_labels, - }, - }, - ) - ) - - wandb.log({"val/images": overlays}) + table = wandb.Table(columns=["ID", "image", "ground truth", "prediction"]) + for i, (img, mask, pred) in enumerate(zip(images.to("cpu"), masks_true.to("cpu"), masks_pred.to("cpu"))): + table.add_data(i, wandb.Image(img), wandb.Image(mask), wandb.Image(pred)) + wandb.log({"predictions_table": table}) net.train()