climecc111 Hamidreza-Hashemp commited on
Commit
0d68b6f
·
verified ·
0 Parent(s):

Duplicate from Hamidreza-Hashemp/FastTracker-Benchmark

Browse files

Co-authored-by: Hamidreza Hashemp <Hamidreza-Hashemp@users.noreply.huggingface.co>

Files changed (41) hide show
  1. .gitattributes +59 -0
  2. GT/task_day_left_turn/gt/gt.txt +0 -0
  3. GT/task_day_left_turn/gt/labels.txt +15 -0
  4. GT/task_day_occlusion/gt/gt.txt +0 -0
  5. GT/task_day_occlusion/gt/labels.txt +15 -0
  6. GT/task_day_pedestrian_crossing/gt/gt.txt +0 -0
  7. GT/task_day_pedestrian_crossing/gt/labels.txt +15 -0
  8. GT/task_day_right_turn/gt/gt.txt +0 -0
  9. GT/task_day_right_turn/gt/labels.txt +15 -0
  10. GT/task_day_right_turn_occlusion/gt/gt.txt +0 -0
  11. GT/task_day_right_turn_occlusion/gt/labels.txt +15 -0
  12. GT/task_day_right_turn_pedestrian/gt/gt.txt +0 -0
  13. GT/task_day_right_turn_pedestrian/gt/labels.txt +15 -0
  14. GT/task_night_far_objects/gt/gt.txt +0 -0
  15. GT/task_night_far_objects/gt/labels.txt +15 -0
  16. GT/task_night_occlusion/gt/gt.txt +0 -0
  17. GT/task_night_occlusion/gt/labels.txt +15 -0
  18. GT/task_night_occlusion_far_objects/gt/gt.txt +0 -0
  19. GT/task_night_occlusion_far_objects/gt/labels.txt +15 -0
  20. GT/task_night_right_turn_pedestrian/gt/gt.txt +0 -0
  21. GT/task_night_right_turn_pedestrian/gt/labels.txt +15 -0
  22. GT/task_night_right_turn_pedestrian_occlusion/gt/gt.txt +0 -0
  23. GT/task_night_right_turn_pedestrian_occlusion/gt/labels.txt +15 -0
  24. GT/task_tunnel/gt/gt.txt +0 -0
  25. GT/task_tunnel/gt/labels.txt +15 -0
  26. README.md +105 -0
  27. Videos_/night_occlusion_far_objects.mp4 +3 -0
  28. Videos_/task_day_left_turn.mp4 +3 -0
  29. Videos_/task_day_occlusion.mp4 +3 -0
  30. Videos_/task_day_pedestrian_crossing.mp4 +3 -0
  31. Videos_/task_day_right_turn.mp4 +3 -0
  32. Videos_/task_day_right_turn_occlusion.mp4 +3 -0
  33. Videos_/task_day_right_turn_pedestrian.mp4 +3 -0
  34. Videos_/task_night_far_objects.mp4 +3 -0
  35. Videos_/task_night_occlusion.mp4 +3 -0
  36. Videos_/task_night_right_turn_pedestrian.mp4 +3 -0
  37. Videos_/task_night_right_turn_pedestrian_occlusion.mp4 +3 -0
  38. Videos_/task_tunnel.mp4 +3 -0
  39. convert_to_coco.py +104 -0
  40. extract_frames.py +60 -0
  41. fig/fasttrack_benchmark.jpg +3 -0
.gitattributes ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mds filter=lfs diff=lfs merge=lfs -text
13
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
14
+ *.model filter=lfs diff=lfs merge=lfs -text
15
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
16
+ *.npy filter=lfs diff=lfs merge=lfs -text
17
+ *.npz filter=lfs diff=lfs merge=lfs -text
18
+ *.onnx filter=lfs diff=lfs merge=lfs -text
19
+ *.ot filter=lfs diff=lfs merge=lfs -text
20
+ *.parquet filter=lfs diff=lfs merge=lfs -text
21
+ *.pb filter=lfs diff=lfs merge=lfs -text
22
+ *.pickle filter=lfs diff=lfs merge=lfs -text
23
+ *.pkl filter=lfs diff=lfs merge=lfs -text
24
+ *.pt filter=lfs diff=lfs merge=lfs -text
25
+ *.pth filter=lfs diff=lfs merge=lfs -text
26
+ *.rar filter=lfs diff=lfs merge=lfs -text
27
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
28
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar filter=lfs diff=lfs merge=lfs -text
31
+ *.tflite filter=lfs diff=lfs merge=lfs -text
32
+ *.tgz filter=lfs diff=lfs merge=lfs -text
33
+ *.wasm filter=lfs diff=lfs merge=lfs -text
34
+ *.xz filter=lfs diff=lfs merge=lfs -text
35
+ *.zip filter=lfs diff=lfs merge=lfs -text
36
+ *.zst filter=lfs diff=lfs merge=lfs -text
37
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
38
+ # Audio files - uncompressed
39
+ *.pcm filter=lfs diff=lfs merge=lfs -text
40
+ *.sam filter=lfs diff=lfs merge=lfs -text
41
+ *.raw filter=lfs diff=lfs merge=lfs -text
42
+ # Audio files - compressed
43
+ *.aac filter=lfs diff=lfs merge=lfs -text
44
+ *.flac filter=lfs diff=lfs merge=lfs -text
45
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
46
+ *.ogg filter=lfs diff=lfs merge=lfs -text
47
+ *.wav filter=lfs diff=lfs merge=lfs -text
48
+ # Image files - uncompressed
49
+ *.bmp filter=lfs diff=lfs merge=lfs -text
50
+ *.gif filter=lfs diff=lfs merge=lfs -text
51
+ *.png filter=lfs diff=lfs merge=lfs -text
52
+ *.tiff filter=lfs diff=lfs merge=lfs -text
53
+ # Image files - compressed
54
+ *.jpg filter=lfs diff=lfs merge=lfs -text
55
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
56
+ *.webp filter=lfs diff=lfs merge=lfs -text
57
+ # Video files - compressed
58
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
59
+ *.webm filter=lfs diff=lfs merge=lfs -text
GT/task_day_left_turn/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_day_left_turn/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_day_occlusion/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_day_occlusion/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_day_pedestrian_crossing/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_day_pedestrian_crossing/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_day_right_turn/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_day_right_turn/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_day_right_turn_occlusion/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_day_right_turn_occlusion/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_day_right_turn_pedestrian/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_day_right_turn_pedestrian/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_night_far_objects/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_night_far_objects/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_night_occlusion/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_night_occlusion/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_night_occlusion_far_objects/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_night_occlusion_far_objects/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_night_right_turn_pedestrian/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_night_right_turn_pedestrian/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_night_right_turn_pedestrian_occlusion/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_night_right_turn_pedestrian_occlusion/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
GT/task_tunnel/gt/gt.txt ADDED
The diff for this file is too large to render. See raw diff
 
GT/task_tunnel/gt/labels.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bus_small
3
+ bus_big
4
+ truck_small
5
+ truck_big
6
+ car
7
+ bike
8
+ motorbike
9
+ ignore_region
10
+ tractor
11
+ trailor
12
+ wheelchair
13
+ heavy_equipment
14
+ pm
15
+ umbrella
README.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: bigscience-openrail-m
3
+ task_categories:
4
+ - object-detection
5
+ language:
6
+ - en
7
+ tags:
8
+ - Multi-object-tracking
9
+ pretty_name: FastTracker-Benchmark
10
+ size_categories:
11
+ - 100K<n<1M
12
+ ---
13
+
14
+ # FastTracker Benchmark
15
+
16
+ ### A new benchmark dataset comprising diverse vehicle classes with frame-level tracking annotation introduced in paper: *FastTracker: Real-Time and Accurate Visual Tracking*
17
+ _[Hamidreza Hashempoor](https://hamidreza-hashempoor.github.io/), Yu Dong Hwang_.
18
+
19
+ ## Resources
20
+ | Github | Paper |
21
+ |:-----------------:|:-------:|
22
+ |[![github](https://img.shields.io/badge/Github-Code-blue)](https://github.com/Hamidreza-Hashempoor/FastTracker)|[![arXiv](https://img.shields.io/badge/arXiv-2508.14370-blue)](https://arxiv.org/abs/2508.14370)
23
+
24
+
25
+ <div align="center">
26
+ <img src="./fig/fasttrack_benchmark.jpg" width="40%" alt="MiroThinker" />
27
+ </div>
28
+
29
+
30
+ ---
31
+
32
+
33
+
34
+ ## Dataset Overview
35
+
36
+
37
+
38
+ Brief statistics and visualization of FastTracker benchmark and its comparison with other benchmarks.
39
+
40
+ | Attribute | UrbanTracker | CityFlow | FastTracker |
41
+ |----------------|--------------|----------|-----------|
42
+ | **Year** | 2014 | 2022 | 2025 |
43
+ | **Detections** | 12.5K | 890K | 800K |
44
+ | **#Videos** | 5 | 40 | 12 |
45
+ | **Obj/Frame** | 5.4 | 8.2 | 43.5 |
46
+ | **#Classes** | 3 | 1 | 9 |
47
+ | **#Scenarios** | 1 | 4 | 12 |
48
+
49
+
50
+
51
+ ---
52
+
53
+ ## Dataset Summary
54
+
55
+ - **What is it?**
56
+ FastTrack is a large-scale benchmark dataset for evaluating multi-object tracking in complex and high-density traffic environments. It includes 800K annotated object detections across 12 videos, with an average of 43.5 objects per frame. The dataset features 9 traffic-related classes and covers diverse real-world traffic scenarios—such as multilane intersections, tunnels, crosswalks, and merging roads—captured under varying lighting conditions (daytime, nighttime, shadows).
57
+
58
+ - **Why was it created?**
59
+ FastTrack was created to address limitations of existing benchmarks like UrbanTracker and CityFlow, which lack diversity in scene types and have lower object density. This benchmark introduces challenging conditions including extreme crowding, long-term occlusions, and diverse motion patterns, to push the boundaries of modern multi-object tracking algorithms—particularly those optimized for real-world, urban traffic settings.
60
+
61
+ - **What can it be used for?**
62
+ Multi-object tracking, re-identification, online tracking evaluation, urban scene understanding, and benchmarking tracking algorithms under occlusion and crowding.
63
+
64
+ - **Who are the intended users?**
65
+ Researchers and practitioners in computer vision and intelligent transportation systems, especially those focusing on real-time tracking, urban mobility, autonomous driving, and edge deployment. Also valuable for students and developers working on lightweight or environment-aware tracking models.
66
+
67
+ ---
68
+
69
+
70
+ ## Dataset Structure
71
+
72
+ ### Data Format
73
+
74
+ GT format is like (each line):
75
+ `frame, id, bb_left, bb_top, bb_width, bb_height, conf, class, 1.0`.
76
+
77
+ To prepare the dataset, first run `extract_frames.py` to decode frames from each video.
78
+ In **line 11** of the script, add the video filename and the number of frames you want to extract.
79
+ ```bash
80
+ python extract_frames.py
81
+ ```
82
+
83
+ Then, convert the ground truth into COCO format with:
84
+ ```bash
85
+ python convert_to_coco.py
86
+ ```
87
+ This will generate annotations/train.json ready for training your detector.
88
+
89
+
90
+
91
+ ## Citation
92
+ If you use our code or Benchmark, please cite our work.
93
+
94
+
95
+ ```
96
+ @misc{hashempoor2025fasttrackerrealtimeaccuratevisual,
97
+ title={FastTracker: Real-Time and Accurate Visual Tracking},
98
+ author={Hamidreza Hashempoor and Yu Dong Hwang},
99
+ year={2025},
100
+ eprint={2508.14370},
101
+ archivePrefix={arXiv},
102
+ primaryClass={cs.CV},
103
+ url={https://arxiv.org/abs/2508.14370},
104
+ }
105
+ ```
Videos_/night_occlusion_far_objects.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9eff2bb95e195a14f7a2b9cf83e7a10e85a7cef22a36a87719fd6dd0c9157cb0
3
+ size 29183584
Videos_/task_day_left_turn.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4fde5aefb66ffd282e35ef0217a52c8d59acf373314d1aac9d4468fcc65b823
3
+ size 19418590
Videos_/task_day_occlusion.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b2ce1fe23c6615aafa738244cc942464f79d6df87d5600ba4a49692ec74b0db
3
+ size 17578267
Videos_/task_day_pedestrian_crossing.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:365ffbaf54424f7e303a0fc71ba3dfd97dcd24dadfac08d64d08e41b61ff79ca
3
+ size 16706342
Videos_/task_day_right_turn.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:024dc305add0da14d7d37c445c089f4f7ea003113c660acd4afca2ed1be18097
3
+ size 17972349
Videos_/task_day_right_turn_occlusion.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16414e766e0c3b721cbd573e4955e5a2fc9ca4b596d718dee963428cfb634822
3
+ size 17795404
Videos_/task_day_right_turn_pedestrian.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11949b92474ffd1b27b33617ca8f53a952c801cd00f4e0bec1fa9e12d5d5f1fe
3
+ size 17085242
Videos_/task_night_far_objects.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c46a6698a0a86185317c236ac61aeb838a6223d98f4e66df0037576135470171
3
+ size 29490160
Videos_/task_night_occlusion.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:627c0dc4ea2145538b19d1610c555eddc48740863c0155e998c3c1553ddebbba
3
+ size 15835611
Videos_/task_night_right_turn_pedestrian.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87ef2a06a722c2bebc0c5b7dd08b8072c9b22873f9e9d1dafd1836cb52a685f8
3
+ size 16784463
Videos_/task_night_right_turn_pedestrian_occlusion.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad233e78a5da58e971afc38a13066992fef721e3f8f2a305cbf6164bad38515a
3
+ size 18553799
Videos_/task_tunnel.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:213b8f7c82c2e7c6d12bda5190a341950471a332dcd81315103c2ee9088cc2e7
3
+ size 31518293
convert_to_coco.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import cv2
4
+ import numpy as np
5
+
6
+ # Paths
7
+ FRAMES_DIR = "test_frame"
8
+ GT_DIR = "GT"
9
+ OUT_PATH = "annotations"
10
+ os.makedirs(OUT_PATH, exist_ok=True)
11
+
12
+ # Output COCO-style JSON
13
+ out_file = os.path.join(OUT_PATH, "train.json")
14
+
15
+ out = {
16
+ "images": [],
17
+ "annotations": [],
18
+ "videos": [],
19
+ "categories": [
20
+ {"id": 1, "name": "pedestrian"} # You can expand with more classes if needed
21
+ ]
22
+ }
23
+
24
+ image_cnt = 0
25
+ ann_cnt = 0
26
+ video_cnt = 0
27
+ tid_curr = 0
28
+ tid_last = -1
29
+
30
+ # Loop over sequences (one per video)
31
+ for seq in sorted(os.listdir(FRAMES_DIR)):
32
+ seq_path = os.path.join(FRAMES_DIR, seq)
33
+ if not os.path.isdir(seq_path):
34
+ continue
35
+
36
+ video_cnt += 1
37
+ out["videos"].append({"id": video_cnt, "file_name": seq})
38
+
39
+ # Frames
40
+ images = sorted([f for f in os.listdir(seq_path) if f.endswith(".jpg")])
41
+ num_images = len(images)
42
+
43
+ for i, img_name in enumerate(images):
44
+ img_path = os.path.join(seq_path, img_name)
45
+ img = cv2.imread(img_path)
46
+ if img is None:
47
+ continue
48
+ height, width = img.shape[:2]
49
+
50
+ image_info = {
51
+ "file_name": f"{seq}/{img_name}",
52
+ "id": image_cnt + i + 1,
53
+ "frame_id": i + 1,
54
+ "prev_image_id": image_cnt + i if i > 0 else -1,
55
+ "next_image_id": image_cnt + i + 2 if i < num_images - 1 else -1,
56
+ "video_id": video_cnt,
57
+ "height": height,
58
+ "width": width
59
+ }
60
+ out["images"].append(image_info)
61
+
62
+ # Load GT file
63
+ gt_path = os.path.join(GT_DIR, seq, "gt", "gt.txt")
64
+ if not os.path.exists(gt_path):
65
+ print(f" No GT found for {seq}, skipping annotations.")
66
+ image_cnt += num_images
67
+ continue
68
+
69
+ anns = np.loadtxt(gt_path, dtype=np.float32, delimiter=",")
70
+
71
+ for i in range(anns.shape[0]):
72
+ frame_id = int(anns[i][0])
73
+ track_id = int(anns[i][1])
74
+ x, y, w, h = anns[i][2:6]
75
+ conf = anns[i][6]
76
+ class_id = int(anns[i][7])
77
+ visibility = anns[i][8]
78
+
79
+ ann_cnt += 1
80
+ if track_id != tid_last:
81
+ tid_curr += 1
82
+ tid_last = track_id
83
+
84
+ ann = {
85
+ "id": ann_cnt,
86
+ "category_id": class_id,
87
+ "image_id": image_cnt + frame_id,
88
+ "track_id": tid_curr,
89
+ "bbox": [float(x), float(y), float(w), float(h)],
90
+ "conf": float(conf),
91
+ "iscrowd": 0,
92
+ "area": float(w * h),
93
+ }
94
+ out["annotations"].append(ann)
95
+
96
+ image_cnt += num_images
97
+
98
+ print(f" Loaded {len(out['images'])} images and {len(out['annotations'])} annotations.")
99
+
100
+ # Save JSON
101
+ with open(out_file, "w") as f:
102
+ json.dump(out, f)
103
+
104
+ print(f" Saved COCO-style annotations to {out_file}")
extract_frames.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import cv2
3
+ import numpy as np
4
+
5
+ # Paths
6
+ videos_dir = "test_vid"
7
+ frames_dir = "test_frame"
8
+
9
+ # Define how many frames to extract for each video (should be same in GT file last row)
10
+ frames_to_extract = {
11
+ "task_day_left_turn-2024_07_31_02_12_05-mot 1.1.mp4": 1965,
12
+ # add more here...
13
+ }
14
+
15
+ os.makedirs(frames_dir, exist_ok=True)
16
+
17
+ for video_file in os.listdir(videos_dir):
18
+ if video_file.lower().endswith(".mp4"):
19
+ video_path = os.path.join(videos_dir, video_file)
20
+
21
+ # Subdirectory name (remove .mp4)
22
+ subdir_name = os.path.splitext(video_file)[0]
23
+ subdir_path = os.path.join(frames_dir, subdir_name)
24
+ os.makedirs(subdir_path, exist_ok=True)
25
+
26
+ cap = cv2.VideoCapture(video_path)
27
+ total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
28
+ desired_frames = frames_to_extract.get(video_file, total_frames)
29
+
30
+ saved = 0
31
+ frames = []
32
+
33
+ while True:
34
+ ret, frame = cap.read()
35
+ if not ret:
36
+ break
37
+ frames.append(frame)
38
+
39
+ cap.release()
40
+
41
+
42
+ if desired_frames > len(frames):
43
+ last_frame = frames[-1]
44
+ while len(frames) < desired_frames:
45
+ frames.append(last_frame)
46
+
47
+
48
+ if desired_frames < len(frames):
49
+ indices = np.linspace(0, len(frames) - 1, desired_frames, dtype=int)
50
+ frames = [frames[i] for i in indices]
51
+
52
+
53
+ for idx, frame in enumerate(frames):
54
+ frame_filename = os.path.join(subdir_path, f"frame_{idx:05d}.jpg")
55
+ cv2.imwrite(frame_filename, frame)
56
+ saved += 1
57
+
58
+ print(f"Extracted {saved} frames from {video_file} into {subdir_name}/")
59
+
60
+ print(" Done extracting frames for all videos.")
fig/fasttrack_benchmark.jpg ADDED

Git LFS Details

  • SHA256: 7f493abb08faf5e31d98960424943eb41640e5703ad6930a58736fa28df14466
  • Pointer size: 131 Bytes
  • Size of remote file: 130 kB