Allow batch based metrics calculation of sklearn.metrics

### Describe the workflow you want to enable

I have a lot of data and need to calculate metrics such as accuracy_score, jaccard_score, f1_score, recall, precision etc.

### Describe your proposed solution

 When I try to calculate these it can literally take days, so i created a small solution which can batch and avg in the end, or for the weighted metrics it can do a weighted avg of each, this accelerated the calculation to just a couple of minutes, because I have a 32 core CPU. I'm willing to contribute with the proper guidance as I'm unfamiliar with the codebase, but I think many people can benefit from this. I'm unsure if there is already a work around of this present in the codebase, but if there is one do let me know, thanks a lot.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

_No response_

COMMENT:
No, memory isn't an issue. It's also possible that I'm calculating it incorrectly, or there is already an existing workaround for this. But here is what's happening,
This is the current code:
```
def evaluate(model: DeepLabV3Plus, test_loader):
    model.eval()
    all_preds, all_targets = [], []

    with torch.no_grad():
        for batch in tqdm(test_loader, desc="Evaluating"):
            inputs, targets = batch["image"].to(DEVICE), batch["mask"].to(DEVICE)
            inputs = inputs.float().to(DEVICE)
            outputs = model(inputs)
            targets = targets.unsqueeze(1)
            preds = torch.sigmoid(outputs).cpu().numpy()
            all_preds.append(preds)
            all_targets.append(targets.cpu().numpy())
    print("Evaluation completed. Calculating metrics...")

    all_preds = np.concatenate(all_preds, axis=0)
    all_targets = np.concatenate(all_targets, axis=0)

    preds_binary = (all_preds > 0.5).astype(int)

    accuracy = accuracy_score(all_targets.flatten(), preds_binary.flatten())
    jaccard = jaccard_score(all_targets.flatten(), preds_binary.flatten(), average='binary')
    f1 = f1_score(all_targets.flatten(), preds_binary.flatten(), average='binary')
    recall = recall_score(all_targets.flatten(), preds_binary.flatten(), average='binary')
    precision = precision_score(all_targets.flatten(), preds_binary.flatten(), average='binary')

    print(f"Accuracy: {accuracy:.4f}, Jaccard: {jaccard:.4f}, F1 Score: {f1:.4f}")
    print(f"Recall: {recall:.4f}, Precision: {precision:.4f}")
```
When I try to calculate it in this way, all the predictions and targets are calculated pretty quickly. When I flatten and give it to all the metrics(jaccard, f1, recall, precision, etc). It takes a long time, most probably because this is a lot of data in my case, roughly 17000 images, 512x512, flattened. The bottlenecks are the metric functions. I want a way to allow these functions to support some sort of parallelism by doing batch processing and averaging those, or something along those lines. Let me know what you think. I'm sure this can be implemented by applying batching or threading outside, but it would be nice to have if it were built in.
If there's already a recommended way to handle this, please let me know. If not, I’d be happy to help contribute a solution with guidance. Thanks!

Labels: Performance, help wanted, module:metrics, Needs Investigation