code: def _build_mask_train_sample(record: RecordType):
      assert (
          len(record.detection.label_ids)
          == len(record.detection.bboxes)
          == len(record.detection.bboxes)
      )
  
      image, target = _build_train_sample(record=record)
  
      # If no labels and bboxes are present, use as negative samples as described in
      # https://github.com/pytorch/vision/releases/tag/v0.6.0
      if len(record.detection.masks) == 0:
          height, width = record.img.shape[:-1]
          target["masks"] = torch.zeros(
              (0, height, width), dtype=torch.uint8
          )
      else:
          target["masks"] = tensor(
              record.detection.mask_array.data, dtype=torch.uint8
          )
  
      return image, target
  
file_path: icevision/icevision/models/torchvision/mask_rcnn/dataloaders.py
imports: from icevision.imports import *
  from icevision.core import *
  from icevision.models.utils import *
  from icevision.models.torchvision.dataloaders import _build_train_sample
  from icevision.models.torchvision.dataloaders import build_infer_batch, infer_dl
label_desc: Use image node_id 3 for calling a global function with example usage: _build_mask_train_sample(record) and returns: image,  target