code: def prepare_target(annotations, img_id, img_size):
      boxes = [annot["bbox"] for annot in annotations]
      boxes = np.array(boxes, dtype=np.float32).reshape(-1, 4)
      boxes[:, 2:] += boxes[:, :2]
      boxes[:, 0::2] = boxes[:, 0::2].clip(0, img_size[1])
      boxes[:, 1::2] = boxes[:, 1::2].clip(0, img_size[0])
      keep = (boxes[:, 3] > boxes[:, 1]) & (boxes[:, 2] > boxes[:, 0])
      boxes = boxes[keep]
      classes = [annot["category_id"] for annot in annotations]
      classes = np.array(classes, dtype=np.int64)
      classes = classes[keep]
      return {
          "boxes": boxes,
          "labels": classes,
          "image_id": img_id,
          "image_size": img_size,
      }
  
file_path: tinygrad/extra/datasets/openimages.py
imports: import os
  import math
  import json
  import numpy
  from PIL import Image
  import pathlib
  import boto3, botocore
  from tinygrad.helpers import fetch
  from tqdm import tqdm
  import pandas
  import concurrent.futures
label_desc: Use image node_id 8 for calling a global function with example usage: prepare_target(annotations, img_id, img_size) and returns: dict