code: def create_model_input(img, inst=None):
      if inst is not None:
          return {"image": img, "instances": inst}
      else:
          return {"image": img}
  
imports: import itertools
  import unittest
  from contextlib import contextmanager
  from copy import deepcopy
  import torch
  from detectron2.structures import BitMasks, Boxes, ImageList, Instances
  from detectron2.utils.events import EventStorage
  from detectron2.utils.testing import get_model_no_weights
label_desc: Use image node_id 2 for calling a global function with example usage: create_model_input(img, inst) and returns: dict, dict