revert: want back to table display for predictions

Former-commit-id: 2af16f486ffeaca232aee35d360fe75e78adfc9e [formerly e072ee4b33587b45f6c6c34f809b9638a9e0b569]
Former-commit-id: 69c874da0fbe6e2a5cb2421fa20ffb9c34b36fc1
This commit is contained in:
Laurent Fainsin 2022-06-30 11:44:39 +02:00
parent dc4a399c0f
commit f4ed2f799e

View file

@ -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()