code: def coco_instances(tmpdir):
      rand_image = Image.fromarray(
          np.random.randint(0, 255, (64, 64, 3), dtype="uint8")
      )
      os.makedirs(tmpdir / "train_folder", exist_ok=True)
      os.makedirs(tmpdir / "predict_folder", exist_ok=True)
  
      train_folder = tmpdir / "train_folder"
      train_ann_file = tmpdir / "train_annotations.json"
      predict_folder = tmpdir / "predict_folder"
  
      _ = [
          rand_image.save(str(train_folder / f"image_{i}.png"))
          for i in range(1, 4)
      ]
      _ = [
          rand_image.save(
              str(predict_folder / f"predict_image_{i}.png")
          )
          for i in range(1, 4)
      ]
      annotations = {
          "annotations": [
              {
                  "area": 50,
                  "bbox": [10, 20, 5, 10],
                  "category_id": 1,
                  "id": 1,
                  "image_id": 1,
                  "iscrowd": 0,
                  "segmentation": [[10, 20, 15, 20, 15, 30, 10, 30]],
              },
              {
                  "area": 100,
                  "bbox": [20, 30, 10, 10],
                  "category_id": 2,
                  "id": 2,
                  "image_id": 2,
                  "iscrowd": 0,
                  "segmentation": [[20, 30, 30, 30, 30, 40, 20, 40]],
              },
              {
                  "area": 125,
                  "bbox": [10, 20, 5, 25],
                  "category_id": 1,
                  "id": 3,
                  "image_id": 3,
                  "iscrowd": 0,
                  "segmentation": [[10, 20, 15, 20, 15, 45, 10, 45]],
              },
          ],
          "categories": [
              {"id": 1, "name": "cat", "supercategory": "annimal"},
              {"id": 2, "name": "dog", "supercategory": "annimal"},
          ],
          "images": [
              {
                  "file_name": "image_1.png",
                  "height": 64,
                  "width": 64,
                  "id": 1,
              },
              {
                  "file_name": "image_2.png",
                  "height": 64,
                  "width": 64,
                  "id": 2,
              },
              {
                  "file_name": "image_3.png",
                  "height": 64,
                  "width": 64,
                  "id": 3,
              },
          ],
      }
      with open(train_ann_file, "w") as annotation_file:
          json.dump(annotations, annotation_file)
  
      return COCODataConfig(
          train_folder, train_ann_file, predict_folder
      )
  
imports: import collections
  import json
  import os
  from typing import Any
  import numpy
  import pytest
  import torch
  from flash import Trainer
  from flash.core.data.io.input import DataKeys
  from flash.core.utilities.imports import _ICEDATA_AVAILABLE, _ICEVISION_AVAILABLE, _TOPIC_IMAGE_AVAILABLE
  from flash.image import InstanceSegmentation, InstanceSegmentationData
  from tests.helpers.task_tester import TaskTester
label_desc: Use image node_id 1 for calling a global function with example usage: coco_instances(tmpdir) and returns: COCODataConfig