code: def test_coco_json_prediction(self):
      from sahi.predict import predict
      from sahi.utils.mmdet import (
          MmdetTestConstants,
          download_mmdet_yolox_tiny_model,
      )
      from sahi.utils.yolov5 import (
          Yolov5TestConstants,
          download_yolov5n_model,
      )
  
      # init model
      download_mmdet_yolox_tiny_model()
  
      postprocess_type = "GREEDYNMM"
      match_metric = "IOS"
      match_threshold = 0.5
      class_agnostic = True
  
      # prepare paths
      dataset_json_path = "tests/data/coco_utils/terrain_all_coco.json"
      source = "tests/data/coco_utils/"
      project_dir = "tests/data/predict_result"
  
      # get sliced prediction
      if os.path.isdir(project_dir):
          shutil.rmtree(project_dir, ignore_errors=True)
      predict(
          model_type="mmdet",
          model_path=MmdetTestConstants.MMDET_YOLOX_TINY_MODEL_PATH,
          model_config_path=MmdetTestConstants.MMDET_YOLOX_TINY_CONFIG_PATH,
          model_confidence_threshold=CONFIDENCE_THRESHOLD,
          model_device=MODEL_DEVICE,
          model_category_mapping=None,
          model_category_remapping=None,
          source=source,
          no_sliced_prediction=False,
          no_standard_prediction=True,
          slice_height=512,
          slice_width=512,
          overlap_height_ratio=0.2,
          overlap_width_ratio=0.2,
          postprocess_type=postprocess_type,
          postprocess_match_metric=match_metric,
          postprocess_match_threshold=match_threshold,
          postprocess_class_agnostic=class_agnostic,
          novisual=True,
          export_pickle=False,
          export_crop=False,
          dataset_json_path=dataset_json_path,
          project=project_dir,
          name="exp",
          verbose=1,
      )
  
      # init model
      download_yolov5n_model()
  
      # prepare paths
      dataset_json_path = "tests/data/coco_utils/terrain_all_coco.json"
      source = "tests/data/coco_utils/"
      project_dir = "tests/data/predict_result"
  
      # get sliced prediction
      if os.path.isdir(project_dir):
          shutil.rmtree(project_dir, ignore_errors=True)
      predict(
          model_type="yolov5",
          model_path=Yolov5TestConstants.YOLOV5N_MODEL_PATH,
          model_config_path=None,
          model_confidence_threshold=CONFIDENCE_THRESHOLD,
          model_device=MODEL_DEVICE,
          model_category_mapping=None,
          model_category_remapping=None,
          source=source,
          no_sliced_prediction=False,
          no_standard_prediction=True,
          slice_height=512,
          slice_width=512,
          overlap_height_ratio=0.2,
          overlap_width_ratio=0.2,
          postprocess_type=postprocess_type,
          postprocess_match_metric=match_metric,
          postprocess_match_threshold=match_threshold,
          postprocess_class_agnostic=class_agnostic,
          novisual=True,
          export_pickle=False,
          export_crop=False,
          dataset_json_path=dataset_json_path,
          project=project_dir,
          name="exp",
          verbose=1,
      )
  
file_path: sahi/tests/test_predict.py
imports: import os
  import shutil
  import unittest
  import numpy
  from sahi.utils.cv import read_image
label_desc: Use image node_id 8 for calling the TestPredict obj's underlying member method code with example usage: obj.test_coco_json_prediction() without return types