code: def test_det_rec(self, mock_load):
      mock_load.side_effect = lambda *x, **y: None
      inferencer = MMOCRInferencer(
          det="dbnet_resnet18_fpnc_1200e_icdar2015",
          rec="crnn_mini-vgg_5e_mj",
      )
      img_path = "tests/data/det_toy_dataset/imgs/test/img_1.jpg"
      res_img_path = inferencer(img_path, return_vis=True)
  
      img_paths = [
          "tests/data/det_toy_dataset/imgs/test/img_1.jpg",
          "tests/data/det_toy_dataset/imgs/test/img_2.jpg",
      ]
      res_img_paths = inferencer(img_paths, return_vis=True)
      self.assert_predictions_equal(
          res_img_path["predictions"][0],
          res_img_paths["predictions"][0],
      )
      self.assertTrue(
          np.allclose(
              res_img_path["visualization"][0],
              res_img_paths["visualization"][0],
          )
      )
  
      img_ndarray = mmcv.imread(img_path)
      res_img_ndarray = inferencer(img_ndarray, return_vis=True)
  
      img_ndarrays = [mmcv.imread(p) for p in img_paths]
      res_img_ndarrays = inferencer(img_ndarrays, return_vis=True)
      self.assert_predictions_equal(
          res_img_ndarray["predictions"][0],
          res_img_ndarrays["predictions"][0],
      )
      self.assertTrue(
          np.allclose(
              res_img_ndarray["visualization"][0],
              res_img_ndarrays["visualization"][0],
          )
      )
      # cross checking: ndarray <-> path
      self.assert_predictions_equal(
          res_img_ndarray["predictions"][0],
          res_img_path["predictions"][0],
      )
      self.assertTrue(
          np.allclose(
              res_img_ndarray["visualization"][0],
              res_img_path["visualization"][0],
          )
      )
  
      # test save_vis and save_pred
      with tempfile.TemporaryDirectory() as tmp_dir:
          res = inferencer(
              img_paths, out_dir=tmp_dir, save_vis=True, save_pred=True
          )
          for img_dir in ["img_1.jpg", "img_2.jpg"]:
              self.assertTrue(
                  osp.exists(osp.join(tmp_dir, "vis", img_dir))
              )
          for i, pred_dir in enumerate(["img_1.json", "img_2.json"]):
              dumped_res = mmengine.load(
                  osp.join(tmp_dir, "preds", pred_dir)
              )
              self.assert_predictions_equal(
                  res["predictions"][i], dumped_res
              )
  
      # corner case: when the det model cannot detect any texts
      inferencer(np.zeros((100, 100, 3)), return_vis=True)
  
file_path: mmocr/tests/test_apis/test_inferencers/test_mmocr_inferencer.py
imports: import os.path
  import random
  import tempfile
  from unittest import TestCase, mock
  import mmcv
  import mmengine
  import numpy
  import torch
  from mmocr.apis.inferencers import MMOCRInferencer
label_desc: Use image node_id 6 for calling the TestMMOCRInferencer obj's underlying member method code with example usage: obj.test_det_rec(mock_load) without return types