cheind / py-motmetrics

:bar_chart: Benchmark multiple object trackers (MOT) in Python
MIT License
1.37k stars 258 forks source link

Why idp and idr samein result? #176

Open madenburak opened 1 year ago

madenburak commented 1 year ago

idp and idr value is same, also idp and precision or idr and recall value is same too. I don't understand this issue.

I used this code snippet:

track_lines = np.loadtxt(track_txt_path, delimiter=" ")
    ground_ids = []
    track_ids = []

    for frame in range(len(ground_lines)):

        gt_dets = [ground_lines[frame, :]] # select all detections in gt
        t_dets = [track_lines[frame, :]] # select all detections in t

        C = mm.distances.iou_matrix(gt_dets, t_dets, \
                                    max_iou=0.5) # format: gt, t

        #Normally, there is must include ids of object in txt file
        ground_ids.append(frame)
        track_ids.append(frame)

        acc.update([ground_ids[frame]], [track_ids[frame]], C)
        mh = mm.metrics.create()

    summary = mh.compute(acc, metrics=['num_frames', 'idf1', 'idp', 'idr', \
                                     'recall', 'precision', 'num_objects', \
                                     'mostly_tracked', 'partially_tracked', \
                                     'mostly_lost', 'num_false_positives', \
                                     'num_misses', 'num_switches', \
                                     'num_fragmentations', 'mota', 'motp' \
                                    ], \
                      name='acc')

    strsummary = mm.io.render_summary(
      summary,
      #formatters={'mota' : '{:.2%}'.format},
      namemap={'idf1': 'IDF1', 'idp': 'IDP', 'idr': 'IDR', 'recall': 'Rcll', \
               'precision': 'Prcn', 'num_objects': 'GT', \
               'mostly_tracked' : 'MT', 'partially_tracked': 'PT', \
               'mostly_lost' : 'ML', 'num_false_positives': 'FP', \
               'num_misses': 'FN', 'num_switches' : 'IDsw', \
               'num_fragmentations' : 'FM', 'mota': 'MOTA', 'motp' : 'MOTP',  \
              }
  )
    print(strsummary)