code: def detection_monitoring_plot(
      ax1,
      metrics,
      exp_name,
      color_palette,
      epoch,
      figure_ix,
      separate_values_dict,
      do_validation,
  ):
      monitor_values_keys = metrics["train"]["monitor_values"][1][
          0
      ].keys()
      separate_values = [
          v for fig_ix in separate_values_dict.values() for v in fig_ix
      ]
      if figure_ix == 0:
          plot_keys = [
              ii
              for ii in monitor_values_keys
              if ii not in separate_values
          ]
          plot_keys += [
              k
              for k in metrics["train"].keys()
              if k != "monitor_values"
          ]
      else:
          plot_keys = separate_values_dict[figure_ix]
  
      x = np.arange(1, epoch + 1)
  
      for kix, pk in enumerate(plot_keys):
          if pk in metrics["train"].keys():
              y_train = metrics["train"][pk][1:]
              if do_validation:
                  y_val = metrics["val"][pk][1:]
          else:
              y_train = [
                  np.mean(
                      [
                          er[pk]
                          for er in metrics["train"]["monitor_values"][
                              e
                          ]
                      ]
                  )
                  for e in x
              ]
              if do_validation:
                  y_val = [
                      np.mean(
                          [
                              er[pk]
                              for er in metrics["val"][
                                  "monitor_values"
                              ][e]
                          ]
                      )
                      for e in x
                  ]
  
          ax1.plot(
              x,
              y_train,
              label="train_{}".format(pk),
              linestyle="--",
              color=color_palette[kix],
          )
          if do_validation:
              ax1.plot(
                  x,
                  y_val,
                  label="val_{}".format(pk),
                  linestyle="-",
                  color=color_palette[kix],
              )
  
      if epoch == 1:
          box = ax1.get_position()
          ax1.set_position(
              [box.x0, box.y0, box.width * 0.8, box.height]
          )
          ax1.legend(loc="center left", bbox_to_anchor=(1, 0.5))
          ax1.set_title(exp_name)
  
file_path: medicaldetectiontoolkit/plotting.py
imports: import matplotlib
  import matplotlib.pyplot
  import matplotlib.gridspec
  import numpy
  import os
  from copy import deepcopy
label_desc: Use image node_id 2 for calling a global function with example usage: detection_monitoring_plot(ax1, metrics, exp_name, color_palette, epoch, figure_ix, separate_values_dict, do_validation) without return types