code: def test_pred2dict(self):
      data_sample = TextDetDataSample()
      data_sample.pred_instances = InstanceData()
  
      data_sample.pred_instances.scores = np.array([0.9])
      data_sample.pred_instances.polygons = [
          np.array([0, 0, 0, 1, 1, 1, 1, 0])
      ]
      res = self.inferencer.pred2dict(data_sample)
      self.assertListAlmostEqual(
          res["polygons"], [[0, 0, 0, 1, 1, 1, 1, 0]]
      )
      self.assertListAlmostEqual(res["scores"], [0.9])
  
      data_sample.pred_instances.bboxes = np.array([[0, 0, 1, 1]])
      data_sample.pred_instances.scores = torch.FloatTensor([0.9])
      res = self.inferencer.pred2dict(data_sample)
      self.assertListAlmostEqual(
          res["polygons"], [[0, 0, 0, 1, 1, 1, 1, 0]]
      )
      self.assertListAlmostEqual(res["bboxes"], [[0, 0, 1, 1]])
      self.assertListAlmostEqual(res["scores"], [0.9])
  
imports: import os.path
  import random
  import tempfile
  from unittest import TestCase, mock
  import mmcv
  import mmengine
  import numpy
  import torch
  from mmengine.structures import InstanceData
  from mmocr.apis.inferencers import TextDetInferencer
  from mmocr.utils.check_argument import is_type_list
  from mmocr.utils.typing_utils import TextDetDataSample
label_desc: Use image node_id 8 for calling the TestTextDetinferencer obj's underlying member method code with example usage: obj.test_pred2dict() without return types