code: def test_overlay_instances(self):
      img, boxes, labels, polygons, masks = self._random_data()
  
      v = Visualizer(img, self.metadata)
      output = v.overlay_instances(
          masks=polygons, boxes=boxes, labels=labels
      ).get_image()
      self.assertEqual(output.shape, img.shape)
  
      # Test 2x scaling
      v = Visualizer(img, self.metadata, scale=2.0)
      output = v.overlay_instances(
          masks=polygons, boxes=boxes, labels=labels
      ).get_image()
      self.assertEqual(output.shape[0], img.shape[0] * 2)
  
      # Test overlay masks
      v = Visualizer(img, self.metadata)
      output = v.overlay_instances(
          masks=masks, boxes=boxes, labels=labels
      ).get_image()
      self.assertEqual(output.shape, img.shape)
  
imports: import numpy
  import os
  import tempfile
  import unittest
  import cv2
  import torch
  from detectron2.data import MetadataCatalog
  from detectron2.structures import BoxMode, Instances, RotatedBoxes
  from detectron2.utils.visualizer import ColorMode, Visualizer
label_desc: Use image node_id 5 for calling the TestVisualizer obj's underlying member method code with example usage: obj.test_overlay_instances() without return types