code: def im_detect_mask_aug(model, im, boxes):
      """Performs mask detection with test-time augmentations.
  
      Arguments:
          model (DetectionModelHelper): the detection model to use
          im (ndarray): BGR image to test
          boxes (ndarray): R x 4 array of bounding boxes
  
      Returns:
          masks (ndarray): R x K x M x M array of class specific soft masks
      """
      assert (
          not cfg.TEST.MASK_AUG.SCALE_SIZE_DEP
      ), "Size dependent scaling not implemented"
  
      # Collect masks computed under different transformations
      masks_ts = []
  
      # Compute masks for the original image (identity transform)
      im_scale_i = im_conv_body_only(
          model, im, cfg.TEST.SCALE, cfg.TEST.MAX_SIZE
      )
      masks_i = im_detect_mask(model, im_scale_i, boxes)
      masks_ts.append(masks_i)
  
      # Perform mask detection on the horizontally flipped image
      if cfg.TEST.MASK_AUG.H_FLIP:
          masks_hf = im_detect_mask_hflip(
              model, im, cfg.TEST.SCALE, cfg.TEST.MAX_SIZE, boxes
          )
          masks_ts.append(masks_hf)
  
      # Compute detections at different scales
      for scale in cfg.TEST.MASK_AUG.SCALES:
          max_size = cfg.TEST.MASK_AUG.MAX_SIZE
          masks_scl = im_detect_mask_scale(
              model, im, scale, max_size, boxes
          )
          masks_ts.append(masks_scl)
  
          if cfg.TEST.MASK_AUG.SCALE_H_FLIP:
              masks_scl_hf = im_detect_mask_scale(
                  model, im, scale, max_size, boxes, hflip=True
              )
              masks_ts.append(masks_scl_hf)
  
      # Compute masks at different aspect ratios
      for aspect_ratio in cfg.TEST.MASK_AUG.ASPECT_RATIOS:
          masks_ar = im_detect_mask_aspect_ratio(
              model, im, aspect_ratio, boxes
          )
          masks_ts.append(masks_ar)
  
          if cfg.TEST.MASK_AUG.ASPECT_RATIO_H_FLIP:
              masks_ar_hf = im_detect_mask_aspect_ratio(
                  model, im, aspect_ratio, boxes, hflip=True
              )
              masks_ts.append(masks_ar_hf)
  
      # Combine the predicted soft masks
      if cfg.TEST.MASK_AUG.HEUR == "SOFT_AVG":
          masks_c = np.mean(masks_ts, axis=0)
      elif cfg.TEST.MASK_AUG.HEUR == "SOFT_MAX":
          masks_c = np.amax(masks_ts, axis=0)
      elif cfg.TEST.MASK_AUG.HEUR == "LOGIT_AVG":
  
          def logit(y):
              return -1.0 * np.log((1.0 - y) / np.maximum(y, 1e-20))
  
          logit_masks = [logit(y) for y in masks_ts]
          logit_masks = np.mean(logit_masks, axis=0)
          masks_c = 1.0 / (1.0 + np.exp(-logit_masks))
      else:
          raise NotImplementedError(
              "Heuristic {} not supported".format(
                  cfg.TEST.MASK_AUG.HEUR
              )
          )
  
      return masks_c
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from collections import defaultdict
  import cv2
  import logging
  import numpy
  from caffe2.python import core
  from caffe2.python import workspace
  import pycocotools.mask
  from detectron.core.config import cfg
  from detectron.utils.timer import Timer
  import detectron.core.test_retinanet
  import detectron.modeling.FPN
  import detectron.utils.blob
  import detectron.utils.boxes
  import detectron.utils.image
  import detectron.utils.keypoints
label_desc: Use image node_id 9 for calling a global function with example usage: im_detect_mask_aug(model, im, boxes) and returns: masks_c, unknown