code: def get_best(best_file, metrics, resume_model=None):
      """Get best metrics and iter from file"""
      best_metrics_data = {}
      if os.path.exists(best_file) and (resume_model is not None):
          values = []
          with open(best_file, "r") as f:
              lines = f.readlines()
              for line in lines:
                  line = line.strip()
                  key, value = line.split(" ")
                  best_metrics_data[key] = eval(value)
                  if key == "iter":
                      best_iter = eval(value)
      else:
          for key in metrics:
              best_metrics_data[key] = np.inf
          best_iter = -1
      return best_metrics_data, best_iter
  
file_path: PaddleSeg/Matting/ppmatting/core/train.py
imports: import os
  import time
  from collections import deque, defaultdict
  import pickle
  import shutil
  import numpy
  import paddle
  import paddle.nn.functional
  from paddleseg.utils import TimeAverager, calculate_eta, resume, logger, train_profiler
  from .val import evaluate
label_desc: Use image node_id 3 for calling a global function with example usage: get_best(best_file, metrics, resume_model) and returns: best_metrics_data,  best_iter