code: def test_load_img(self):
      data_prefix = osp.join(
          osp.dirname(__file__), "../../data/rec_toy_dataset/imgs/"
      )
  
      results = dict(img_path=osp.join(data_prefix, "1036169.jpg"))
      transform = LoadImageFromFile(min_size=0)
      results = transform(copy.deepcopy(results))
      self.assertEquals(
          results["img_path"], osp.join(data_prefix, "1036169.jpg")
      )
      self.assertEquals(results["img"].shape, (25, 119, 3))
      self.assertEquals(results["img"].dtype, np.uint8)
      self.assertEquals(results["img_shape"], (25, 119))
      self.assertEquals(results["ori_shape"], (25, 119))
      self.assertEquals(
          repr(transform),
          (
              "LoadImageFromFile(ignore_empty=False, min_size=0, "
              "to_float32=False, color_type='color', imdecode_backend='cv2', "
              "backend_args=None)"
          ),
      )
  
      # to_float32
      transform = LoadImageFromFile(to_float32=True)
      results = transform(copy.deepcopy(results))
      self.assertEquals(results["img"].dtype, np.float32)
  
      # min_size
      transform = LoadImageFromFile(min_size=26, ignore_empty=True)
      self.assertIsNone(transform(copy.deepcopy(results)))
      transform = LoadImageFromFile(min_size=26)
      with self.assertRaises(IOError):
          transform(copy.deepcopy(results))
  
      # test load empty
      fake_img_path = osp.join(data_prefix, "fake.jpg")
      results = dict(img_path=fake_img_path)
      transform = LoadImageFromFile(ignore_empty=False)
      with self.assertRaises(FileNotFoundError):
          transform(copy.deepcopy(results))
      transform = LoadImageFromFile(ignore_empty=True)
      results = transform(copy.deepcopy(results))
      self.assertIsNone(results)
  
      data_prefix = osp.join(osp.dirname(__file__), "../../data")
      broken_img_path = osp.join(data_prefix, "broken.jpg")
      results = dict(img_path=broken_img_path)
      transform = LoadImageFromFile(ignore_empty=False)
      with self.assertRaises(IOError):
          transform(copy.deepcopy(results))
      transform = LoadImageFromFile(ignore_empty=True)
      results = transform(copy.deepcopy(results))
      self.assertIsNone(results)
  
imports: import copy
  import os.path
  from unittest import TestCase
  import mmcv
  import numpy
  from mmocr.datasets.transforms import InferencerLoader, LoadImageFromFile, LoadKIEAnnotations, LoadOCRAnnotations
label_desc: Use image node_id 1 for calling the TestLoadImageFromFile obj's underlying member method code with example usage: obj.test_load_img() without return types