code: def test_object_detection_tiny_yolov3(
      input_image, output_type, extract_objects
  ):
      detector = CustomObjectDetection()
      detector.setModelTypeAsTinyYOLOv3()
      detector.setModelPath(
          os.path.join(
              test_folder,
              "data-models",
              "tiny_yolov3_number-plate-dataset-imageai_mAP-0.22595_epoch-20.pt",
          )
      )
      detector.setJsonPath(
          os.path.join(
              test_folder,
              "data-json",
              "number-plate-dataset-imageai_tiny_yolov3_detection_config.json",
          )
      )
      detector.loadModel()
  
      output_img_path = os.path.join(
          test_folder, "data-images", str(uuid.uuid4()) + ".jpg"
      )
  
      if output_type == "array":
          if extract_objects:
              (
                  output_image_array,
                  detections,
                  extracted_objects,
              ) = detector.detectObjectsFromImage(
                  input_image=input_image,
                  output_type=output_type,
                  extract_detected_objects=extract_objects,
              )
  
              assert len(detections) > 0
              assert len(extracted_objects) == len(detections)
              for extracted_obj in extracted_objects:
                  assert type(extracted_obj) == np.ndarray
          else:
              (
                  output_image_array,
                  detections,
              ) = detector.detectObjectsFromImage(
                  input_image=input_image, output_type=output_type
              )
              assert type(output_image_array) == np.ndarray
              assert len(detections) > 0
      else:
          if extract_objects:
              (
                  detections,
                  extracted_object_paths,
              ) = detector.detectObjectsFromImage(
                  input_image=input_image,
                  output_image_path=output_img_path,
                  extract_detected_objects=True,
              )
  
              assert len(detections) > 0
              assert os.path.isfile(output_img_path)
              assert len(extracted_object_paths) == len(detections)
              delete_cache(extracted_object_paths)
              delete_cache([extracted_object_paths[0], output_img_path])
          else:
              detections = detector.detectObjectsFromImage(
                  input_image=input_image,
                  output_image_path=output_img_path,
              )
              assert len(detections) > 0
              delete_cache([output_img_path])
  
      assert type(detections) == list
  
      for eachObject in detections:
          assert type(eachObject) == dict
          assert "name" in eachObject.keys()
          assert type(eachObject["name"]) == str
          assert "percentage_probability" in eachObject.keys()
          assert type(eachObject["percentage_probability"]) == float
          assert "box_points" in eachObject.keys()
          assert type(eachObject["box_points"]) == list
          box_points = eachObject["box_points"]
          for point in box_points:
              assert type(point) == int
          assert box_points[0] < box_points[2]
          assert box_points[1] < box_points[3]
  
file_path: ImageAI/test/test_custom_object_detection.py
imports: import os, sys
  from typing import List
  import shutil
  import cv2
  import uuid
  from PIL import Image
  import numpy
  import pytest
  from os.path import dirname
  from imageai.Detection.Custom import CustomObjectDetection
label_desc: Use image node_id 3 for calling a global function with example usage: test_object_detection_tiny_yolov3(input_image, output_type, extract_objects) without return types