Skip to content

How to accumulate metrics for multiple validation dataloaders #5793

Discussion options

You must be logged in to vote

You would have to create seperate metrics per validation dataloader (similar to how you need seperate metrics for train/val/test). Something like this could maybe work for you

def __init__(self, ...)
    ...
    self.val_metrics = nn.ModuleList([pl.metrics.Accuracy() for _ in range(n_val_dataloaders)])

def validation_step(self, batch, batch_idx, dataset_idx):
    ...
    self.val_metrics[dataset_idx].update(preds, target)

Replies: 9 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Borda
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@zmurez
Comment options

@SimJeg
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging Related to the `LoggerConnector` and `log()`
4 participants
Converted from issue

This discussion was converted from issue #5701 on February 04, 2021 23:35.