code: def test_image_packet_creation_reference_mode(self):
      w, h, channels = (
          random.randrange(3, 100),
          random.randrange(3, 100),
          3,
      )
      rgb_data = np.random.randint(
          255, size=(h, w, channels), dtype=np.uint8
      )
      rgb_data.flags.writeable = False
      initial_ref_count = sys.getrefcount(rgb_data)
      image_packet = packet_creator.create_image(
          image_format=ImageFormat.SRGB, data=rgb_data
      )
      # Reference mode increase the ref count of the rgb_data by 1.
      self.assertEqual(sys.getrefcount(rgb_data), initial_ref_count + 1)
      del image_packet
      gc.collect()
      # Deleting image_packet should decrese the ref count of rgb_data by 1.
      self.assertEqual(sys.getrefcount(rgb_data), initial_ref_count)
      rgb_data_copy = np.copy(rgb_data)
      # rgb_data_copy is a copy of rgb_data and should not increase the ref count.
      self.assertEqual(sys.getrefcount(rgb_data), initial_ref_count)
      text_config = """
        node {
          calculator: 'PassThroughCalculator'
          input_side_packet: "in"
          output_side_packet: "out"
        }
      """
      graph = CalculatorGraph(graph_config=text_config)
      graph.start_run(
          input_side_packets={
              "in": packet_creator.create_image(
                  image_format=ImageFormat.SRGB, data=rgb_data
              )
          }
      )
      # reference mode increase the ref count of the rgb_data by 1.
      self.assertEqual(sys.getrefcount(rgb_data), initial_ref_count + 1)
      graph.wait_until_done()
      output_packet = graph.get_output_side_packet("out")
      del rgb_data
      del graph
      gc.collect()
      # The pixel data of the output image frame packet should still be valid
      # after the graph and the original rgb_data data are deleted.
      self.assertTrue(
          np.array_equal(
              packet_getter.get_image(output_packet).numpy_view(),
              rgb_data_copy,
          )
      )
  
imports: import gc
  import random
  import sys
  from absl.testing import absltest
  import numpy
  from google.protobuf import text_format
  from mediapipe.framework.formats import detection_pb2
  from mediapipe.python import packet_creator
  from mediapipe.python import packet_getter
  from mediapipe.python._framework_bindings import calculator_graph
  from mediapipe.python._framework_bindings import image
  from mediapipe.python._framework_bindings import image_frame
  from mediapipe.python._framework_bindings import packet
label_desc: Use image node_id 32 for calling the PacketTest obj's underlying member method code with example usage: obj.test_image_packet_creation_reference_mode() without return types