code: def demo_mm_inputs(
      batch_size=2,
      image_shapes=(3, 128, 128),
      num_items=None,
      num_classes=10,
      sem_seg_output_strides=1,
      with_mask=False,
      with_semantic=False,
      use_box_type=False,
      device="cpu",
      texts=None,
      custom_entities=False,
  ):
      """Create a superset of inputs needed to run test or train batches.
  
      Args:
          batch_size (int): batch size. Defaults to 2.
          image_shapes (List[tuple], Optional): image shape.
              Defaults to (3, 128, 128)
          num_items (None | List[int]): specifies the number
              of boxes in each batch item. Default to None.
          num_classes (int): number of different labels a
              box might have. Defaults to 10.
          with_mask (bool): Whether to return mask annotation.
              Defaults to False.
          with_semantic (bool): whether to return semantic.
              Defaults to False.
          device (str): Destination device type. Defaults to cpu.
      """
      rng = np.random.RandomState(0)
  
      if isinstance(image_shapes, list):
          assert len(image_shapes) == batch_size
      else:
          image_shapes = [image_shapes] * batch_size
  
      if isinstance(num_items, list):
          assert len(num_items) == batch_size
  
      if texts is not None:
          assert batch_size == len(texts)
  
      packed_inputs = []
      for idx in range(batch_size):
          image_shape = image_shapes[idx]
          c, h, w = image_shape
  
          image = rng.randint(0, 255, size=image_shape, dtype=np.uint8)
  
          mm_inputs = dict()
          mm_inputs["inputs"] = torch.from_numpy(image).to(device)
  
          img_meta = {
              "img_id": idx,
              "img_shape": image_shape[1:],
              "ori_shape": image_shape[1:],
              "filename": "<demo>.png",
              "scale_factor": np.array([1.1, 1.2]),
              "flip": False,
              "flip_direction": None,
              "border": [1, 1, 1, 1],  # Only used by CenterNet
          }
  
          if texts:
              img_meta["text"] = texts[idx]
              img_meta["custom_entities"] = custom_entities
  
          data_sample = DetDataSample()
          data_sample.set_metainfo(img_meta)
  
          # gt_instances
          gt_instances = InstanceData()
          if num_items is None:
              num_boxes = rng.randint(1, 10)
          else:
              num_boxes = num_items[idx]
  
          bboxes = _rand_bboxes(rng, num_boxes, w, h)
          labels = rng.randint(1, num_classes, size=num_boxes)
          # TODO: remove this part when all model adapted with BaseBoxes
          if use_box_type:
              gt_instances.bboxes = HorizontalBoxes(
                  bboxes, dtype=torch.float32
              )
          else:
              gt_instances.bboxes = torch.FloatTensor(bboxes)
          gt_instances.labels = torch.LongTensor(labels)
  
          if with_mask:
              masks = _rand_masks(rng, num_boxes, bboxes, w, h)
              gt_instances.masks = masks
  
          # TODO: waiting for ci to be fixed
          # masks = np.random.randint(0, 2, (len(bboxes), h, w), dtype=np.uint8)
          # gt_instances.mask = BitmapMasks(masks, h, w)
  
          data_sample.gt_instances = gt_instances
  
          # ignore_instances
          ignore_instances = InstanceData()
          bboxes = _rand_bboxes(rng, num_boxes, w, h)
          if use_box_type:
              ignore_instances.bboxes = HorizontalBoxes(
                  bboxes, dtype=torch.float32
              )
          else:
              ignore_instances.bboxes = torch.FloatTensor(bboxes)
          data_sample.ignored_instances = ignore_instances
  
          # gt_sem_seg
          if with_semantic:
              # assume gt_semantic_seg using scale 1/8 of the img
              gt_semantic_seg = torch.from_numpy(
                  np.random.randint(
                      0,
                      num_classes,
                      (
                          1,
                          h // sem_seg_output_strides,
                          w // sem_seg_output_strides,
                      ),
                      dtype=np.uint8,
                  )
              )
              gt_sem_seg_data = dict(sem_seg=gt_semantic_seg)
              data_sample.gt_sem_seg = PixelData(**gt_sem_seg_data)
  
          mm_inputs["data_samples"] = data_sample.to(device)
  
          # TODO: gt_ignore
  
          packed_inputs.append(mm_inputs)
      data = pseudo_collate(packed_inputs)
      return data
  
imports: import copy
  from os.path import dirname, exists, join
  import numpy
  import torch
  from mmengine.config import Config
  from mmengine.dataset import pseudo_collate
  from mmengine.structures import InstanceData, PixelData
  from mmdet.utils.util_random import ensure_rng
  from ..registry import TASK_UTILS
  from ..structures import DetDataSample, TrackDataSample
  from ..structures.bbox import HorizontalBoxes
label_desc: Use image node_id 7 for calling a global function with example usage: demo_mm_inputs(batch_size, image_shapes, num_items, num_classes, sem_seg_output_strides, with_mask, with_semantic, use_box_type, device, texts, custom_entities) and returns: data