code: def extract_info_from_file(log_file, result_dict, speed_dict):
      # extract info from file name
      exp_config = log_file.split("/")[-2]
      model = exp_config.split("_")[2]
      mode = exp_config.split("_")[3]
      precision = exp_config.split("_")[4]
      batch_size_per_device = exp_config.split("_")[6]
      run_case = exp_config.split("_")[7]  # eg: 1n1g
      test_iter = int(exp_config.split("_")[8][2:])
      node_num = int(run_case[0])
      if len(run_case) == 4:
          card_num = int(run_case[-2])
      elif len(run_case) == 5:
          card_num = int(run_case[-3:-1])
  
      avg_speed_list = []
      # extract info from file content
      with open(log_file) as f:
          lines = f.readlines()
          for line in lines:
              if "throughput:" in line:
                  p1 = re.compile(r" ips: ([0-9]+\.[0-9]+)", re.S)
                  item = re.findall(p1, line)
                  a = float(item[0].strip())
                  avg_speed_list.append(a)
  
      # compute avg throughoutput
      avg_speed = round(
          np.mean(
              avg_speed_list[args.warmup_batches : args.train_batches]
          ),
          2,
      )
  
      speed_dict[mode][model][run_case][precision][
          batch_size_per_device
      ][test_iter] = avg_speed
      average_speed = compute_average(
          speed_dict[mode][model][run_case][precision][
              batch_size_per_device
          ]
      )
      median_speed = compute_median(
          speed_dict[mode][model][run_case][precision][
              batch_size_per_device
          ]
      )
  
      result_dict[mode][model][run_case][precision][
          batch_size_per_device
      ]["average_speed"] = average_speed
      result_dict[mode][model][run_case][precision][
          batch_size_per_device
      ]["median_speed"] = median_speed
  
file_path: insightface/recognition/arcface_paddle/tools/extract_perf_logs.py
imports: import os
  import re
  import sys
  import glob
  import json
  import argparse
  import pprint
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: extract_info_from_file(log_file, result_dict, speed_dict) without return types