code: def test_adapt_predictions(self):
      data_sample = DetDataSample
      data = TextDetDataSample()
  
      pred_instances = InstanceData()
      pred_instances.scores = torch.randn(1)
      pred_instances.labels = torch.Tensor([1])
      pred_instances.bboxes = torch.Tensor([[0, 0, 2, 2]])
      pred_instances.masks = torch.rand(1, 10, 10)
      data_sample.pred_instances = pred_instances
      results = self.MRCNN.adapt_predictions([data_sample], [data])
      self.assertEqual(len(results), 1)
      self.assertIsInstance(results[0], TextDetDataSample)
      self.assertTrue("polygons" in results[0].pred_instances.keys())
  
      data_sample = TextDetDataSample()
      data = TextDetDataSample()
      pred_instances = InstanceData()
      pred_instances.scores = torch.randn(1)
      pred_instances.labels = torch.Tensor([1])
      pred_instances.bboxes = torch.Tensor([[0, 0, 2, 2]])
      data_sample.pred_instances = pred_instances
      results = self.FCOS.adapt_predictions([data_sample], [data])
      self.assertEqual(len(results), 1)
      self.assertIsInstance(results[0], TextDetDataSample)
      self.assertTrue("polygons" in results[0].pred_instances.keys())
  
file_path: mmocr/tests/test_models/test_textdet/test_wrappers/test_mmdet_wrapper.py
imports: import unittest
  import torch
  from mmdet.structures import DetDataSample
  from mmdet.testing import demo_mm_inputs
  from mmengine.config import Config
  from mmengine.registry import init_default_scope
  from mmengine.structures import InstanceData
  from mmocr.registry import MODELS
  from mmocr.structures import TextDetDataSample
label_desc: Use image node_id 4 for calling the TestMMDetWrapper obj's underlying member method code with example usage: obj.test_adapt_predictions() without return types