code: def main(args):
      assert args.mode in ["image2bin", "bin2image"]
      os.makedirs(args.image_path, exist_ok=True)
      os.makedirs(args.bin_path, exist_ok=True)
      assert os.path.isdir(args.image_path)
      assert os.path.isdir(args.bin_path)
  
      if args.mode == "image2bin":
          img_list = get_file_list(args.image_path)
          for idx, img_fp in enumerate(img_list):
              if idx % len(img_list) == 1000:
                  print(
                      "conversion process: [{}]/[{}]".format(
                          idx, len(img_list)
                      )
                  )
              img_name = os.path.basename(img_fp)
              output_path = os.path.join(
                  args.bin_path, os.path.splitext(img_name)[0] + ".bin"
              )
              trans_img_to_bin(img_fp, output_path)
      elif args.mode == "bin2image":
          bin_list = get_file_list(args.bin_path, end=("bin",))
          for idx, bin_fp in enumerate(bin_list):
              if idx % len(bin_list) == 1000:
                  print(
                      "conversion process: [{}]/[{}]".format(
                          idx, len(bin_list)
                      )
                  )
              bin_name = os.path.basename(bin_fp)
              output_path = os.path.join(
                  args.image_path,
                  os.path.splitext(bin_name)[0] + ".jpg",
              )
              img = read_img_from_bin(bin_fp)
              cv2.imwrite(output_path, img)
  
      print("ok..")
  
file_path: insightface/recognition/arcface_paddle/tools/convert_image_bin.py
imports: import os
  import sys
  import argparse
  import cv2
  from datasets.kv_helper import read_img_from_bin
  from datasets.kv_helper import trans_img_to_bin
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types