code: def process_results(
      prediction, confidence=0.9, num_classes=80, nms_conf=0.4
  ):
      prediction = prediction.detach().numpy()
      conf_mask = prediction[:, :, 4] > confidence
      conf_mask = np.expand_dims(conf_mask, 2)
      prediction = prediction * conf_mask
      # Non max suppression
      box_corner = prediction
      box_corner[:, :, 0] = (
          prediction[:, :, 0] - prediction[:, :, 2] / 2
      )
      box_corner[:, :, 1] = (
          prediction[:, :, 1] - prediction[:, :, 3] / 2
      )
      box_corner[:, :, 2] = (
          prediction[:, :, 0] + prediction[:, :, 2] / 2
      )
      box_corner[:, :, 3] = (
          prediction[:, :, 1] + prediction[:, :, 3] / 2
      )
      prediction[:, :, :4] = box_corner[:, :, :4]
      write = False
      # Process img
      img_pred = prediction[0]
      max_conf = np.amax(img_pred[:, 5 : 5 + num_classes], axis=1)
      max_conf_score = np.argmax(
          img_pred[:, 5 : 5 + num_classes], axis=1
      )
      max_conf_score = np.expand_dims(max_conf_score, axis=1)
      max_conf = np.expand_dims(max_conf, axis=1)
      seq = (img_pred[:, :5], max_conf, max_conf_score)
      image_pred = np.concatenate(seq, axis=1)
      non_zero_ind = np.nonzero(image_pred[:, 4])[0]
      assert all(image_pred[non_zero_ind, 0] > 0)
      image_pred_ = np.reshape(
          image_pred[np.squeeze(non_zero_ind), :], (-1, 7)
      )
      if image_pred_.shape[0] == 0:
          print("No detections found!")
          return 0
      for cls in np.unique(image_pred_[:, -1]):
          # perform NMS, get the detections with one particular class
          cls_mask = image_pred_ * np.expand_dims(
              image_pred_[:, -1] == cls, axis=1
          )
          class_mask_ind = np.squeeze(np.nonzero(cls_mask[:, -2]))
          # class_mask_ind = np.nonzero()
          image_pred_class = np.reshape(
              image_pred_[class_mask_ind], (-1, 7)
          )
          # sort the detections such that the entry with the maximum objectness
          # confidence is at the top
          conf_sort_index = np.argsort(image_pred_class[:, 4])
          image_pred_class = image_pred_class[conf_sort_index]
          for i in range(image_pred_class.shape[0]):
              # Get the IOUs of all boxes that come after the one we are looking at in the loop
              try:
                  ious = bbox_iou(
                      np.expand_dims(image_pred_class[i], axis=0),
                      image_pred_class[i + 1 :],
                  )
              except:
                  break
              # Zero out all the detections that have IoU > threshold
              iou_mask = np.expand_dims((ious < nms_conf), axis=1)
              image_pred_class[i + 1 :] *= iou_mask
              # Remove the non-zero entries
              non_zero_ind = np.squeeze(
                  np.nonzero(image_pred_class[:, 4])
              )
              image_pred_class = np.reshape(
                  image_pred_class[non_zero_ind], (-1, 7)
              )
          batch_ind = np.array([[0]])
          seq = (batch_ind, image_pred_class)
          if not write:
              output, write = np.concatenate(seq, axis=1), True
          else:
              out = np.concatenate(seq, axis=1)
              output = np.concatenate((output, out))
      return output
  
imports: import sys
  import io
  import time
  import math
  import cv2
  import numpy
  from PIL import Image
  from tinygrad.tensor import Tensor
  from tinygrad.nn import BatchNorm2d, Conv2d
  from tinygrad.helpers import fetch
label_desc: Use image node_id 4 for calling a global function with example usage: process_results(prediction, confidence, num_classes, nms_conf) and returns: output, int