code: def test_perform_inference_with_mask_output(self):
      from sahi.models.mmdet import MmdetDetectionModel
  
      # init model
      download_mmdet_cascade_mask_rcnn_model()
  
      mmdet_detection_model = MmdetDetectionModel(
          model_path=MmdetTestConstants.MMDET_CASCADEMASKRCNN_MODEL_PATH,
          config_path=MmdetTestConstants.MMDET_CASCADEMASKRCNN_CONFIG_PATH,
          confidence_threshold=CONFIDENCE_THRESHOLD,
          device=MODEL_DEVICE,
          category_remapping=None,
          load_at_init=True,
          image_size=IMAGE_SIZE,
      )
  
      # prepare image
      image = read_image(IMAGE_PATH)
  
      # perform inference
      mmdet_detection_model.perform_inference(image)
      original_predictions = mmdet_detection_model.original_predictions
  
      # check actual prediction structures
      pred = original_predictions[0]
      self.assertTrue("bboxes" in pred)
      self.assertTrue("masks" in pred)
      self.assertTrue("scores" in pred)
      self.assertTrue("labels" in pred)
  
      # all annotations have the same length
      n_preds = len(pred["bboxes"])
      self.assertTrue(len(pred["bboxes"]) == n_preds)
      self.assertTrue(len(pred["masks"]) == n_preds)
      self.assertTrue(len(pred["labels"]) == n_preds)
      self.assertTrue(len(pred["scores"]) == n_preds)
  
      boxes = np.array(pred["bboxes"])
      scores = np.array(pred["scores"])
  
      # ensure all prediction scores are greater then 0.5
      idx = np.where(scores >= 0.5)[0]
  
      # compare
      self.assertTrue([446, 304, 490, 346] in boxes[idx].astype(int))
  
file_path: sahi/tests/test_mmdetectionmodel.py
imports: import unittest
  import numpy
  from sahi.utils.cv import read_image
  from sahi.utils.file import download_from_url
  from sahi.utils.mmdet import MmdetTestConstants, download_mmdet_cascade_mask_rcnn_model, download_mmdet_yolox_tiny_model
label_desc: Use image node_id 2 for calling the TestMmdetDetectionModel obj's underlying member method code with example usage: obj.test_perform_inference_with_mask_output() without return types