code: def test_coco(self):
      from sahi.utils.coco import Coco
  
      category_mapping = {1: "human", 2: "car"}
      # init coco
      coco_path = "tests/data/coco_utils/terrain_all_coco.json"
      coco_dict = load_json(coco_path)
      coco1 = Coco.from_coco_dict_or_path(coco_dict)
      coco2 = Coco.from_coco_dict_or_path(coco_path)
  
      # compare
      self.assertEqual(len(coco1.images), 3)
      self.assertEqual(len(coco2.images), 3)
      self.assertEqual(
          coco1.images[2].annotations[1].category_name, "human"
      )
      self.assertEqual(
          coco2.images[2].annotations[1].category_name, "human"
      )
      self.assertEqual(
          coco1.images[1].annotations[1].segmentation,
          [[501, 451, 622, 451, 622, 543, 501, 543]],
      )
      self.assertEqual(
          coco2.images[1].annotations[1].segmentation,
          [[501, 451, 622, 451, 622, 543, 501, 543]],
      )
      self.assertEqual(
          coco1.category_mapping,
          category_mapping,
      )
      self.assertEqual(
          coco2.category_mapping,
          category_mapping,
      )
      self.assertEqual(
          coco1.stats,
          coco2.stats,
      )
      self.assertEqual(
          coco1.stats["num_images"],
          len(coco1.images),
      )
      self.assertEqual(
          coco1.stats["num_annotations"],
          len(coco1.json["annotations"]),
      )
  
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 7 for calling the TestCocoUtils obj's underlying member method code with example usage: obj.test_coco() without return types