code: def test_mask2former_head_predict(self):
      mask2former_head = Mask2FormerTrackHead(**self.config)
      mask2former_head.training = False
      mask2former_head.init_weights()
      s = 256
      # assume the video has 30 frames
      feats = [
          torch.rand(30, 256 * (2**i), s // stride, s // stride)
          for i, stride in enumerate([8, 16, 32, 64])
      ]
  
      img_metas = dict(
          img_shape=(s, s),
          ori_shape=(s, s),
          scale_factor=(1, 1),
          pad_shape=(s, s),
          batch_input_shape=(s, s),
      )
  
      img_data_samples = [
          DetDataSample(metainfo=img_metas) for _ in range(30)
      ]
      data_sample = TrackDataSample()
      data_sample.video_data_samples = img_data_samples
      results = mask2former_head.predict(feats, data_sample)
  
      assert len(results) == 30
  
file_path: mmdetection/tests/test_models/test_tracking_heads/test_mask2former_track_head.py
imports: from unittest import TestCase
  import torch
  from mmengine import Config
  from mmdet.models.tracking_heads import Mask2FormerTrackHead
  from mmdet.structures import DetDataSample, TrackDataSample
  from mmdet.testing import demo_track_inputs
label_desc: Use image node_id 3 for calling the TestMask2FormerHead obj's underlying member method code with example usage: obj.test_mask2former_head_predict() without return types