code: def eval_predictions(
      pred_dir,
      anno_dir,
      list_path,
      iou_thresholds=[0.5],
      width=30,
      official=True,
      sequential=False,
  ):
      logger.info("Calculating metric for List: {}".format(list_path))
      predictions = load_culane_data(pred_dir, list_path)
      annotations = load_culane_data(anno_dir, list_path)
      img_shape = (590, 1640, 3)
      if sequential:
          results = map(
              partial(
                  culane_metric,
                  width=width,
                  official=official,
                  iou_thresholds=iou_thresholds,
                  img_shape=img_shape,
              ),
              predictions,
              annotations,
          )
      else:
          from multiprocessing import Pool, cpu_count
          from itertools import repeat
  
          with Pool(cpu_count()) as p:
              results = p.starmap(
                  culane_metric,
                  zip(
                      predictions,
                      annotations,
                      repeat(width),
                      repeat(iou_thresholds),
                      repeat(official),
                      repeat(img_shape),
                  ),
              )
  
      mean_f1, mean_prec, mean_recall, total_tp, total_fp, total_fn = (
          0,
          0,
          0,
          0,
          0,
          0,
      )
      ret = {}
      for thr in iou_thresholds:
          tp = sum(m[thr][0] for m in results)
          fp = sum(m[thr][1] for m in results)
          fn = sum(m[thr][2] for m in results)
          precision = float(tp) / (tp + fp) if tp != 0 else 0
          recall = float(tp) / (tp + fn) if tp != 0 else 0
          f1 = (
              2 * precision * recall / (precision + recall)
              if tp != 0
              else 0
          )
          logger.info(
              "iou thr: {:.2f}, tp: {}, fp: {}, fn: {},"
              "precision: {}, recall: {}, f1: {}".format(
                  thr, tp, fp, fn, precision, recall, f1
              )
          )
          mean_f1 += f1 / len(iou_thresholds)
          mean_prec += precision / len(iou_thresholds)
          mean_recall += recall / len(iou_thresholds)
          total_tp += tp
          total_fp += fp
          total_fn += fn
          ret[thr] = {
              "TP": tp,
              "FP": fp,
              "FN": fn,
              "Precision": precision,
              "Recall": recall,
              "F1": f1,
          }
      if len(iou_thresholds) > 2:
          logger.info(
              "mean result, total_tp: {}, total_fp: {}, total_fn: {},"
              "precision: {}, recall: {}, f1: {}".format(
                  total_tp,
                  total_fp,
                  total_fn,
                  mean_prec,
                  mean_recall,
                  mean_f1,
              )
          )
          ret["mean"] = {
              "TP": total_tp,
              "FP": total_fp,
              "FN": total_fn,
              "Precision": mean_prec,
              "Recall": mean_recall,
              "F1": mean_f1,
          }
      return ret
  
imports: import os
  import cv2
  import numpy
  import os.path
  from functools import partial
  from .metrics import Metric
  from scipy.interpolate import splprep, splev
  from scipy.optimize import linear_sum_assignment
  from shapely.geometry import LineString, Polygon
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 8 for calling a global function with example usage: eval_predictions(pred_dir, anno_dir, list_path, iou_thresholds, width, official, sequential) and returns: ret