code: def test_coco_image(self):
      from sahi.utils.coco import (
          CocoAnnotation,
          CocoImage,
          CocoPrediction,
      )
  
      # init coco image
      file_name = "tests/data/small-vehicles1.jpeg"
      height = 580
      width = 1068
      coco_image = CocoImage(file_name, height, width)
  
      # create and add first annotation
      coco_segmentation = [[1, 1, 325, 125, 250, 200, 5, 200]]
      category_id = 3
      category_name = "car"
      coco_annotation_1 = CocoAnnotation.from_coco_segmentation(
          segmentation=coco_segmentation,
          category_id=category_id,
          category_name=category_name,
      )
      coco_image.add_annotation(coco_annotation_1)
  
      # create and add second annotation
      coco_bbox = [1, 1, 100, 100]
      category_id = 2
      category_name = "bus"
      coco_annotation_2 = CocoAnnotation.from_coco_bbox(
          bbox=coco_bbox,
          category_id=category_id,
          category_name=category_name,
      )
      coco_image.add_annotation(coco_annotation_2)
  
      # create and add first prediction
      prediction_coco_segmentation = [
          [4, 3, 315, 124, 265, 198, 5, 198]
      ]
      score = 0.983425
      category_id = 3
      category_name = "car"
      coco_prediction_1 = CocoPrediction.from_coco_segmentation(
          segmentation=prediction_coco_segmentation,
          category_id=category_id,
          category_name=category_name,
          score=score,
      )
      coco_image.add_prediction(coco_prediction_1)
  
      # create and add second prediction
      prediction_coco_bbox = [2, 5, 103, 98]
      score = 0.683465
      category_id = 2
      category_name = "bus"
      coco_prediction_2 = CocoPrediction.from_coco_bbox(
          bbox=prediction_coco_bbox,
          category_id=category_id,
          category_name=category_name,
          score=score,
      )
      coco_image.add_prediction(coco_prediction_2)
  
      # compare
      self.assertEqual(coco_image.file_name, file_name)
      self.assertEqual(coco_image.height, height)
      self.assertEqual(coco_image.width, width)
      self.assertEqual(len(coco_image.annotations), 2)
      self.assertEqual(coco_image.annotations[0].category_id, 3)
      self.assertEqual(coco_image.annotations[0].category_name, "car")
      self.assertEqual(
          coco_image.annotations[0].segmentation, coco_segmentation
      )
      self.assertEqual(coco_image.annotations[1].category_id, 2)
      self.assertEqual(coco_image.annotations[1].category_name, "bus")
      self.assertEqual(coco_image.annotations[1].bbox, coco_bbox)
  
      self.assertEqual(len(coco_image.predictions), 2)
      self.assertEqual(coco_image.predictions[0].category_id, 3)
      self.assertEqual(coco_image.predictions[0].category_name, "car")
      self.assertEqual(
          coco_image.predictions[0].segmentation,
          prediction_coco_segmentation,
      )
      self.assertEqual(coco_image.predictions[0].score, 0.983425)
      self.assertEqual(coco_image.predictions[1].category_id, 2)
      self.assertEqual(coco_image.predictions[1].category_name, "bus")
      self.assertEqual(
          coco_image.predictions[1].bbox, prediction_coco_bbox
      )
      self.assertEqual(coco_image.predictions[1].score, 0.683465)
  
imports: import os
  import shutil
  import unittest
  from sahi.utils.coco import merge, update_categories
  from sahi.utils.file import load_json
label_desc: Use image node_id 4 for calling the TestCocoUtils obj's underlying member method code with example usage: obj.test_coco_image() without return types