class_docstr: Generate confusion matrix every epoch and send it to wandb.
  Expects validation step to return predictions and targets.
class_docstr_tok: ["Generate","confusion","matrix","every","epoch","and","send","it","to","wandb",".","Expects","validation","step","to","return","predictions","and","targets","."]
docstr: Gather data from single batch.
docstr_tok: ["Gather","data","from","single","batch","."]
code: def on_validation_batch_end(
      self,
      trainer,
      pl_module,
      outputs,
      batch,
      batch_idx,
      dataloader_idx,
  ):
      """Gather data from single batch."""
      if self.ready:
          self.preds.append(outputs["preds"])
          self.targets.append(outputs["targets"])
  
imports: import subprocess
  from pathlib import Path
  from typing import List
  import matplotlib.pyplot
  import seaborn
  import torch
  import wandb
  from pytorch_lightning import Callback, Trainer
  from pytorch_lightning.loggers import LoggerCollection, WandbLogger
  from pytorch_lightning.utilities import rank_zero_only
  from sklearn import metrics
  from sklearn.metrics import f1_score, precision_score, recall_score
label_desc: Use image node_id 4 for calling the LogConfusionMatrix obj's underlying member method code with example usage: obj.on_validation_batch_end(trainer, pl_module, outputs, batch, batch_idx, dataloader_idx) without return types