format files
This commit is contained in:
1 parent
36bd4c3f11
commit
5cc767a595
1 file changed
+14
-8
@@ -200,8 +200,8 @@ class LogF1PrecRecHeatmapToWandb(Callback):
|
||||
|
||||
class ImagePredictionLogger(Callback):
|
||||
"""Logs a validation batch and their predictions to wandb.
|
||||
Example adapted from:
|
||||
https://wandb.ai/wandb/wandb-lightning/reports/Image-Classification-using-PyTorch-Lightning--VmlldzoyODk1NzY
|
||||
Example adapted from:
|
||||
https://wandb.ai/wandb/wandb-lightning/reports/Image-Classification-using-PyTorch-Lightning--VmlldzoyODk1NzY
|
||||
"""
|
||||
|
||||
def __init__(self, num_samples: int = 8):
|
||||
@@ -231,9 +231,15 @@ class ImagePredictionLogger(Callback):
|
||||
preds = torch.argmax(logits, axis=-1)
|
||||
|
||||
# log the images as wandb Image
|
||||
experiment.log({
|
||||
f"Images/{experiment.name}":[wandb.Image(x, caption=f"Pred:{pred}, Label:{y}")
|
||||
for x, pred, y in zip(val_imgs[:self.num_samples],
|
||||
preds[:self.num_samples],
|
||||
val_labels[:self.num_samples])]
|
||||
})
|
||||
experiment.log(
|
||||
{
|
||||
f"Images/{experiment.name}": [
|
||||
wandb.Image(x, caption=f"Pred:{pred}, Label:{y}")
|
||||
for x, pred, y in zip(
|
||||
val_imgs[: self.num_samples],
|
||||
preds[: self.num_samples],
|
||||
val_labels[: self.num_samples],
|
||||
)
|
||||
]
|
||||
}
|
||||
)
|
||||
Reference in new issue
Block a user