code: def collect_files(img_dir, gt_dir):
      """Collect all images and their corresponding groundtruth files.
  
      Args:
          img_dir (str): The image directory
          gt_dir (str): The groundtruth directory
  
      Returns:
          files (list): The list of tuples (img_file, groundtruth_file)
      """
      assert isinstance(img_dir, str)
      assert img_dir
      assert isinstance(gt_dir, str)
      assert gt_dir
  
      ann_list, imgs_list = [], []
      for img_file in os.listdir(img_dir):
          ann_file = img_file.split("_")[0] + "_gt_ocr.txt"
          ann_list.append(osp.join(gt_dir, ann_file))
          imgs_list.append(osp.join(img_dir, img_file))
  
      files = list(zip(imgs_list, ann_list))
      assert len(files), f"No images found in {img_dir}"
      print(f"Loaded {len(files)} images from {img_dir}")
  
      return files
  
file_path: mmocr/tools/dataset_converters/textrecog/bid_converter.py
imports: import argparse
  import os
  import os.path
  import mmcv
  import mmengine
  from mmocr.utils import crop_img, dump_ocr_data
label_desc: Use image node_id 1 for calling a global function with example usage: collect_files(img_dir, gt_dir) and returns: files