code: def analyze(log_path):
      results = {}
      logs = open(log_path).readlines()
  
      model_pattern = re.compile(r"Test (.*) (.*) (.*) (fp\d+)")
      miou_pattern = re.compile(r"mIoU: (0.\d+)")
      time_pattern = re.compile(r"Average time: (.*) ms/img")
  
      # collect the start num for each test
      model_line_num = []
      for i in range(len(logs)):
          match_obj = re.search(model_pattern, logs[i])
          if match_obj is not None:
              model_line_num.append(i)
  
      # collect the useful information for each test
      for i in range(len(model_line_num)):
          start_num = model_line_num[i]
          end_num = (
              len(logs) - 1
              if i == len(model_line_num) - 1
              else model_line_num[i + 1] - 1
          )
  
          match_obj = re.search(model_pattern, logs[start_num])
          assert match_obj is not None
          model_name = match_obj.group(1)
          info_name = match_obj.group(3) + "_" + match_obj.group(4)
          miou_value = None
          time_value = None
  
          cur_num = end_num
          while cur_num >= start_num and (
              miou_value is None or time_value is None
          ):
              line = logs[cur_num]
              cur_num -= 1
              if miou_value is None:
                  match_obj = re.search(miou_pattern, line)
                  if match_obj is not None:
                      miou_value = float(match_obj.group(1))
              if time_value is None:
                  match_obj = re.search(time_pattern, line)
                  if match_obj is not None:
                      time_value = float(match_obj.group(1))
  
          if model_name not in results:
              results[model_name] = {}
          results[model_name][info_name] = {
              "miou": miou_value,
              "time": time_value,
          }
  
      return results
  
imports: import argparse
  import re
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: analyze(log_path) and returns: results