code: def postprocess_yolov5_prediction(
      y: list[t.Any]
      | tuple[t.Any, ...]
      | torch.Tensor
      | NDArray[t.Any],
      prep: TensorContainer,
      conf_thres: float = 0.25,
      iou_thres: float = 0.45,
      classes: list[int] | None = None,
      agnostic_nms: bool = False,
      max_det: int = 1000,
  ):
      res: dict[str, str] = {}
      names = load_traced_script()[1]["names"]
      if isinstance(y, (list, tuple)):
          y = (
              torch_tensor_from_numpy(y[0])
              if len(y) == 1
              else [torch_tensor_from_numpy(_) for _ in y]
          )
      else:
          y = torch_tensor_from_numpy(y)
  
      y = non_max_suppression(
          y,
          conf_thres,
          iou_thres,
          classes,
          agnostic_nms,
          max_det=max_det,
      )
      # post
      for pred in y:
          if len(pred):
              pred[:, :4] = scale_boxes(
                  prep.im.shape[2:], pred[:, :4], prep.im0.shape
              ).round()
  
              klass: int
              for klass in pred[:, 5].unique():
                  n: torch.Tensor = (pred[:, 5] == klass).sum()
                  res[str(n.item())] = names[int(klass)]
      return res
  
imports: from __future__ import annotations
  import json
  import os
  import time
  import typing
  from pathlib import Path
  import attr
  import cv2
  import numpy
  import torch
  import torchvision
  from PIL import Image
label_desc: Use image node_id 4 for calling a global function with example usage: postprocess_yolov5_prediction(y, prep, conf_thres, iou_thres, classes, agnostic_nms, max_det) and returns: res