code: def read_mot_results(filename, is_gt=False, is_ignore=False):
      valid_label = [1]
      ignore_labels = [
          2,
          7,
          8,
          12,
      ]  # only in motchallenge datasets like 'MOT16'
      if is_gt:
          logger.info(
              "In MOT16/17 dataset the valid_label of ground truth is '{}', "
              "in other dataset it should be '0' for single classs MOT.".format(
                  valid_label[0]
              )
          )
      results_dict = dict()
      if os.path.isfile(filename):
          with open(filename, "r") as f:
              for line in f.readlines():
                  linelist = line.split(",")
                  if len(linelist) < 7:
                      continue
                  fid = int(linelist[0])
                  if fid < 1:
                      continue
                  results_dict.setdefault(fid, list())
  
                  if is_gt:
                      label = int(float(linelist[7]))
                      mark = int(float(linelist[6]))
                      if mark == 0 or label not in valid_label:
                          continue
                      score = 1
                  elif is_ignore:
                      if (
                          "MOT16-" in filename
                          or "MOT17-" in filename
                          or "MOT15-" in filename
                          or "MOT20-" in filename
                      ):
                          label = int(float(linelist[7]))
                          vis_ratio = float(linelist[8])
                          if (
                              label not in ignore_labels
                              and vis_ratio >= 0
                          ):
                              continue
                      else:
                          continue
                      score = 1
                  else:
                      score = float(linelist[6])
  
                  tlwh = tuple(map(float, linelist[2:6]))
                  target_id = int(linelist[1])
  
                  results_dict[fid].append((tlwh, target_id, score))
      return results_dict
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import copy
  import sys
  import math
  from collections import defaultdict
  import numpy
  from ppdet.modeling.bbox_utils import bbox_iou_np_expand
  from .map_utils import ap_per_class
  from .metrics import Metric
  from .munkres import Munkres
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 1 for calling a global function with example usage: read_mot_results(filename, is_gt, is_ignore) and returns: results_dict