Code/3D tracking

Evaluation code

2023. 9. 18. 21:25

https://github.com/cheind/py-motmetrics

 

GitHub - cheind/py-motmetrics: :bar_chart: Benchmark multiple object trackers (MOT) in Python

:bar_chart: Benchmark multiple object trackers (MOT) in Python - GitHub - cheind/py-motmetrics: :bar_chart: Benchmark multiple object trackers (MOT) in Python

github.com

MOT16 format

<frame>, <id>, <bb_left>, <bb_top>, <bb_width>, <bb_height>, <conf>, <x>, <y>, <z>

1280x720 

예시)

1,1,763.00,272.00,189.00,38.00,1,-1,-1,-1
1,2,412.00,265.00,153.00,30.00,1,-1,-1,-1
2,1,762.00,269.00,185.00,41.00,1,-1,-1,-1
2,2,413.00,267.00,151.00,26.00,1,-1,-1,-1
3,1,760.00,272.00,186.00,38.00,1,-1,-1,-1

위와 같은 형태로 gtSource.txt와 tSource.txt만들어야 함.

gt data : bboxes types velos accels ids

ids가 이상하게 되어있음....('-KpKb_7UDmsdQCf8FS3g9w', '1WP4TupVFubSnRO5xzftMw', '3EJCiJ8U4g4vbOqIcPAXMw', '83EloKWTYclrRJDFVF20bw', 'CgfQUOLj5xXGdRUGJ6qHpg', 'DBe_yG1gyQ6IhP0EzGgB0A', 'KQ1PvE1Mq7t4et5JWrjUIw')

association code를 살펴봐야 할 듯함.

Evaluation

def motMetricsEnhancedCalculator(gtSource, tSource):
  # import required packages
  import motmetrics as mm
  import numpy as np
  
  # load ground truth
  gt = np.loadtxt(gtSource, delimiter=',')

  # load tracking output
  t = np.loadtxt(tSource, delimiter=',')

  # Create an accumulator that will be updated during each frame
  acc = mm.MOTAccumulator(auto_id=True)

  # Max frame number maybe different for gt and t files
  for frame in range(int(gt[:,0].max())):
    frame += 1 # detection and frame numbers begin at 1

    # select id, x, y, width, height for current frame
    # required format for distance calculation is X, Y, Width, Height \
    # We already have this format
    gt_dets = gt[gt[:,0]==frame,1:6] # select all detections in gt
    t_dets = t[t[:,0]==frame,1:6] # select all detections in t

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

    # Call update once for per frame.
    # format: gt object ids, t object ids, distance
    acc.update(gt_dets[:,0].astype('int').tolist(), \
              t_dets[:,0].astype('int').tolist(), 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)

 

저작자표시 (새창열림)

'Code > 3D tracking' 카테고리의 다른 글

Simple Track Preprocessing  (0) 2023.10.04
nuScenes tracking data  (0) 2023.10.03
simple track - nuScenes dataset  (0) 2023.09.25
Simple Track demo  (0) 2023.09.16
AB3DMOT evaluation code  (0) 2023.09.15
'Code/3D tracking' 카테고리의 다른 글
  • nuScenes tracking data
  • simple track - nuScenes dataset
  • Simple Track demo
  • AB3DMOT evaluation code
Shy_un
Shy_un
Shy_un
SSHub
Shy_un
전체
오늘
어제
  • 분류 전체보기
    • KaAI
      • CPWC
      • KSC2022
      • KSME2023
    • Paper
      • Video Anomaly Detection
      • Traffic Accident Detection
      • Prediction and Tracking
      • Perception
    • Code
      • preprocess
      • Autoware
      • 3D tracking
      • Review
      • Debug
    • Dataset
      • Argoverse2 dataset
      • TJ4DRadSet
      • K-Radar
      • Nuscenes
      • Dual-Radar
    • Seminar
    • Paradigm
    • Ubuntu

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • Traffic accident detection #Unsupervised learning #GRU #Autoencoder
  • self-supervised learning
  • video anomaly detection

최근 댓글

최근 글

hELLO · Designed By 정상우.
Shy_un
Evaluation code
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.