code: def cal_train_time(log_dicts, args):
      for i, log_dict in enumerate(log_dicts):
          print(
              f'{"-" * 5}Analyze train time of {args.json_logs[i]}{"-" * 5}'
          )
          all_times = []
          for epoch in log_dict.keys():
              if args.include_outliers:
                  all_times.append(log_dict[epoch]["time"])
              else:
                  all_times.append(log_dict[epoch]["time"][1:])
          if not all_times:
              raise KeyError(
                  "Please reduce the log interval in the config so that"
                  "interval is less than iterations of one epoch."
              )
          epoch_ave_time = np.array(
              list(map(lambda x: np.mean(x), all_times))
          )
          slowest_epoch = epoch_ave_time.argmax()
          fastest_epoch = epoch_ave_time.argmin()
          std_over_epoch = epoch_ave_time.std()
          print(
              f"slowest epoch {slowest_epoch + 1}, "
              f"average time is {epoch_ave_time[slowest_epoch]:.4f} s/iter"
          )
          print(
              f"fastest epoch {fastest_epoch + 1}, "
              f"average time is {epoch_ave_time[fastest_epoch]:.4f} s/iter"
          )
          print(f"time std over epochs is {std_over_epoch:.4f}")
          print(
              f"average iter time: {np.mean(epoch_ave_time):.4f} s/iter\n"
          )
  
file_path: mmdetection/tools/analysis_tools/analyze_logs.py
imports: import argparse
  import json
  from collections import defaultdict
  import matplotlib.pyplot
  import numpy
  import seaborn
label_desc: Use image node_id 1 for calling a global function with example usage: cal_train_time(log_dicts, args) without return types