code: def test_model(coco_instances, backbone, head):
      datamodule = InstanceSegmentationData.from_coco(
          train_folder=coco_instances.train_folder,
          train_ann_file=coco_instances.train_ann_file,
          predict_folder=coco_instances.predict_folder,
          transform_kwargs={"image_size": (128, 128)},
          batch_size=2,
      )
  
      assert datamodule.num_classes == 3
      assert datamodule.labels == ["background", "cat", "dog"]
  
      model = InstanceSegmentation(
          num_classes=datamodule.num_classes,
          backbone=backbone,
          head=head,
      )
      trainer = Trainer(fast_dev_run=True)
      trainer.fit(model, datamodule=datamodule)
      trainer.predict(model, datamodule=datamodule)
  
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 2 for calling a global function with example usage: test_model(coco_instances, backbone, head) without return types