code: def _rand_masks(num_items, bboxes, img_w, img_h):
      rng = np.random.RandomState(0)
      masks = np.zeros((num_items, img_h, img_w), dtype=np.float32)
      for i, bbox in enumerate(bboxes):
          bbox = bbox.astype(np.int32)
          mask = (
              rng.rand(1, bbox[3] - bbox[1], bbox[2] - bbox[0]) > 0.3
          ).astype(np.int64)
          masks[i : i + 1, bbox[1] : bbox[3], bbox[0] : bbox[2]] = mask
      return BitmapMasks(masks, height=img_h, width=img_w)
  
file_path: mmdetection/tests/test_models/test_dense_heads/test_boxinst_head.py
imports: from unittest import TestCase
  import numpy
  import torch
  from mmengine import MessageHub
  from mmengine.config import ConfigDict
  from mmengine.structures import InstanceData
  from mmdet.models.dense_heads import BoxInstBboxHead, BoxInstMaskHead
  from mmdet.structures.mask import BitmapMasks
label_desc: Use image node_id 1 for calling a global function with example usage: _rand_masks(num_items, bboxes, img_w, img_h) and returns: BitmapMasks