code: def test_split_coco_as_train_val(self):
      from sahi.utils.coco import Coco
  
      coco_dict_path = "tests/data/coco_utils/combined_coco.json"
      image_dir = "tests/data/coco_utils/"
      coco = Coco.from_coco_dict_or_path(
          coco_dict_path, image_dir=image_dir
      )
      result = coco.split_coco_as_train_val(
          train_split_rate=0.5, numpy_seed=0
      )
      self.assertEqual(len(result["train_coco"].json["images"]), 1)
      self.assertEqual(len(result["train_coco"].json["annotations"]), 5)
      self.assertEqual(
          result["train_coco"].json["images"][0]["height"], 682
      )
      self.assertEqual(result["train_coco"].image_dir, image_dir)
      self.assertEqual(
          result["train_coco"].stats["num_images"],
          len(result["train_coco"].images),
      )
      self.assertEqual(
          result["train_coco"].stats["num_annotations"],
          len(result["train_coco"].json["annotations"]),
      )
  
      self.assertEqual(len(result["val_coco"].json["images"]), 1)
      self.assertEqual(len(result["val_coco"].json["annotations"]), 7)
      self.assertEqual(
          result["val_coco"].json["images"][0]["height"], 1365
      )
      self.assertEqual(result["val_coco"].image_dir, image_dir)
      self.assertEqual(
          result["val_coco"].stats["num_images"],
          len(result["val_coco"].images),
      )
      self.assertEqual(
          result["val_coco"].stats["num_annotations"],
          len(result["val_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 8 for calling the TestCocoUtils obj's underlying member method code with example usage: obj.test_split_coco_as_train_val() without return types