code: def _rand_masks(rng, num_boxes, bboxes, img_w, img_h):
      from mmdet.structures.mask import BitmapMasks
  
      masks = np.zeros((num_boxes, img_h, img_w))
      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)
  
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 6 for calling a global function with example usage: _rand_masks(rng, num_boxes, bboxes, img_w, img_h) and returns: BitmapMasks