code: def compare_dataframes_mtmc(gts, ts):
      try:
          import motmetrics as mm
      except Exception as e:
          raise RuntimeError(
              "Unable to use motmetrics in MTMCT in PP-Tracking, please install motmetrics, for example: `pip install motmetrics`, see https://github.com/longcw/py-motmetrics"
          )
      """Compute ID-based evaluation metrics for MTMCT
      Return:
          df (pandas.DataFrame): Results of the evaluations in a df with only the 'idf1', 'idp', and 'idr' columns.
      """
      gtds = []
      tsds = []
      gtcams = gts["CameraId"].drop_duplicates().tolist()
      tscams = ts["CameraId"].drop_duplicates().tolist()
      maxFrameId = 0
  
      for k in sorted(gtcams):
          gtd = gts.query("CameraId == %d" % k)
          gtd = gtd[["FrameId", "Id", "X", "Y", "Width", "Height"]]
          # max FrameId in gtd only
          mfid = gtd["FrameId"].max()
          gtd["FrameId"] += maxFrameId
          gtd = gtd.set_index(["FrameId", "Id"])
          gtds.append(gtd)
  
          if k in tscams:
              tsd = ts.query("CameraId == %d" % k)
              tsd = tsd[["FrameId", "Id", "X", "Y", "Width", "Height"]]
              # max FrameId among both gtd and tsd
              mfid = max(mfid, tsd["FrameId"].max())
              tsd["FrameId"] += maxFrameId
              tsd = tsd.set_index(["FrameId", "Id"])
              tsds.append(tsd)
  
          maxFrameId += mfid
  
      # compute multi-camera tracking evaluation stats
      multiCamAcc = mm.utils.compare_to_groundtruth(
          pd.concat(gtds), pd.concat(tsds), "iou"
      )
      metrics = list(mm.metrics.motchallenge_metrics)
      metrics.extend(["num_frames", "idfp", "idfn", "idtp"])
      mh = mm.metrics.create()
      summary = mh.compute(
          multiCamAcc, metrics=metrics, name="MultiCam"
      )
      return summary
  
imports: import os
  import re
  import cv2
  import gc
  import numpy
  import pandas
  from tqdm import tqdm
  import warnings
label_desc: Use image node_id 26 for calling a global function with example usage: compare_dataframes_mtmc(gts, ts) and returns: summary