code: def _log_classification_stats(
      pred_logits, gt_classes, prefix="fast_rcnn"
  ):
      """
      Log the classification metrics to EventStorage.
  
      Args:
          pred_logits: Rx(K+1) logits. The last column is for background class.
          gt_classes: R labels
      """
      num_instances = gt_classes.numel()
      if num_instances == 0:
          return
      pred_classes = pred_logits.argmax(dim=1)
      bg_class_ind = pred_logits.shape[1] - 1
  
      fg_inds = (gt_classes >= 0) & (gt_classes < bg_class_ind)
      num_fg = fg_inds.nonzero().numel()
      fg_gt_classes = gt_classes[fg_inds]
      fg_pred_classes = pred_classes[fg_inds]
  
      num_false_negative = (
          (fg_pred_classes == bg_class_ind).nonzero().numel()
      )
      num_accurate = (pred_classes == gt_classes).nonzero().numel()
      fg_num_accurate = (
          (fg_pred_classes == fg_gt_classes).nonzero().numel()
      )
  
      storage = get_event_storage()
      storage.put_scalar(
          f"{prefix}/cls_accuracy", num_accurate / num_instances
      )
      if num_fg > 0:
          storage.put_scalar(
              f"{prefix}/fg_cls_accuracy", fg_num_accurate / num_fg
          )
          storage.put_scalar(
              f"{prefix}/false_negative", num_false_negative / num_fg
          )
  
imports: import logging
  from typing import Callable, Dict, List, Optional, Tuple, Union
  import torch
  from torch import nn
  from torch.nn import functional
  from detectron2.config import configurable
  from detectron2.data.detection_utils import get_fed_loss_cls_weights
  from detectron2.layers import ShapeSpec, batched_nms, cat, cross_entropy, nonzero_tuple
  from detectron2.modeling.box_regression import Box2BoxTransform, _dense_box_regression_loss
  from detectron2.structures import Boxes, Instances
  from detectron2.utils.events import get_event_storage
label_desc: Use image node_id 2 for calling a global function with example usage: _log_classification_stats(pred_logits, gt_classes, prefix) without return types