code: def test_coco_update_categories(self):
      from sahi.utils.coco import Coco
  
      coco_path = "tests/data/coco_utils/terrain2_coco.json"
      image_dir = "tests/data/coco_utils/"
      coco = Coco.from_coco_dict_or_path(coco_path, image_dir=image_dir)
  
      self.assertEqual(len(coco.json["annotations"]), 5)
      self.assertEqual(len(coco.json["images"]), 1)
      self.assertEqual(len(coco.json["categories"]), 1)
      self.assertEqual(
          coco.json["categories"],
          [{"id": 1, "name": "car", "supercategory": "car"}],
      )
      self.assertEqual(coco.json["annotations"][1]["category_id"], 1)
      self.assertEqual(coco.image_dir, image_dir)
      self.assertEqual(coco.stats["num_images"], len(coco.images))
      self.assertEqual(
          coco.stats["num_annotations"], len(coco.json["annotations"])
      )
  
      # update categories
      desired_name2id = {"human": 1, "car": 2, "big_vehicle": 3}
      coco.update_categories(desired_name2id=desired_name2id)
  
      self.assertEqual(len(coco.json["annotations"]), 5)
      self.assertEqual(len(coco.json["images"]), 1)
      self.assertEqual(len(coco.json["categories"]), 3)
      self.assertEqual(
          coco.json["categories"],
          [
              {"id": 1, "name": "human", "supercategory": "human"},
              {"id": 2, "name": "car", "supercategory": "car"},
              {
                  "id": 3,
                  "name": "big_vehicle",
                  "supercategory": "big_vehicle",
              },
          ],
      )
      self.assertEqual(coco.json["annotations"][1]["category_id"], 2)
      self.assertEqual(coco.image_dir, image_dir)
      self.assertEqual(coco.stats["num_images"], len(coco.images))
      self.assertEqual(
          coco.stats["num_annotations"], len(coco.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 11 for calling the TestCocoUtils obj's underlying member method code with example usage: obj.test_coco_update_categories() without return types