Skip to content

Commit 2e79afc

Browse files
authored
Merge pull request #3 from LdDl/bytetrack-impl
Implement ByteTrack
2 parents 62e101a + 1c155df commit 2e79afc

15 files changed

+649
-34
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,26 @@ This one uses similar approach to [this implementation](https://github.com/LdDl/
2121

2222
You can use this library to track vehicles / peoples and etc. when you don't need that much accuracy or ReID.
2323

24+
**What Multi-Object tracking algorithms are implemented?**
25+
- Centroids distance + diagonal - [mot/simple_tracker#38](mot/simple_tracker#38)
26+
- [ByteTrack](https://arxiv.org/abs/2110.06864) using greedy matching algorithm - [mot/bytetrack.go#266](mot/bytetrack.go#266)
27+
- [ByteTrack](https://arxiv.org/abs/2110.06864) using [Hungarian algorithm](https://en.wikipedia.org/wiki/Hungarian_algorithm) via [go-hungarian package](https://github.com/arthurkushman/go-hungarian) - [mot/bytetrack.go#231](mot/bytetrack.go#231)
28+
2429
**Are more advanced algorithms considered to be implemented in futher?**
2530

2631
Yes, I do think so. I guess that [SORT](https://arxiv.org/abs/1602.00763) or naive IoU tracker will be the next one.
2732

2833
If you want to you can contribute via opening [Pull Request](https://github.com/LdDl/mot-go/compare)
2934

35+
**Some examples**
36+
Simple centroid IoU tracker for three simple tracks | ByteTrack + Hungarian algorithm for three simple tracks
37+
:-------------------------:|:-------------------------:
38+
<img src="data/mot_simple_naive.png" width="480"> | <img src="data/mot_simple_bytetrack_naive.png" width="480">
39+
40+
Simple centroid IoU tracker for spread tracks | ByteTrack + Hungarian algorithm for spread tracks
41+
:-------------------------:|:-------------------------:
42+
<img src="data/mot_simple_spread.png" width="480"> | <img src="data/mot_simple_bytetrack_spread.png" width="480">
43+
3044
## How to use
3145

3246
Add dependency into your project:
@@ -72,7 +86,7 @@ func main() {
7286
}
7387
}
7488

75-
file, err := os.Create("blobs_similar.csv")
89+
file, err := os.Create("blobs_naive.csv")
7690
if err != nil {
7791
fmt.Println(err)
7892
return
@@ -110,7 +124,7 @@ If we plot results of filtered tracks we should get something like:
110124

111125
Similar (for code example above) | Spread
112126
:-------------------------:|:-------------------------:
113-
<img src="data/mot_simple_similar.png" width="640"> | <img src="data/mot_simple_spread.png" width="640">
127+
<img src="data/mot_simple_naive.png" width="640"> | <img src="data/mot_simple_spread.png" width="640">
114128

115129
<p style="text-align: center;"><i>Trajectories</i></p>
116130

data/blobs_bytetrack_naive.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
id;track
2+
47a3c463-0a9d-4dde-b50c-b7edecbd12e5;307.000000,94.000000|307.990123,100.930811|306.925635,97.223448|306.424915,100.032976|306.101678,97.519032|305.462788,101.505580|305.919574,106.476751|306.266212,108.169195|306.517856,109.206323|306.340953,110.185572|306.213962,110.801645|306.122439,114.956035|306.353821,114.152431|306.535502,113.438609|306.949610,116.040568|307.020740,118.574446|307.074740,120.549566|307.359304,123.542159|307.353471,126.403898|307.107201,126.807446|307.353806,131.160062|307.790519,130.627929|308.161075,129.991568|308.471670,133.348650|308.728024,132.086040|308.711343,133.521686|308.903814,136.217789|309.057157,137.327026|309.175849,138.152231|309.040748,142.757541|309.578334,146.875245|310.037127,150.303113|309.527690,151.980995|309.956099,155.687916|309.425375,158.940989|310.287148,163.119125|310.587092,166.977610|309.938937,172.323355|310.247886,175.379554|310.510246,177.743357|309.611805,176.821524|310.154121,179.068733|310.628555,180.784977|311.036901,182.040514|311.382415,182.902881|311.669397,183.435601|311.902832,183.697295|312.088101,183.741126|312.230741,183.614522|312.336253,183.359122|312.409955,183.010896|312.456875,182.600398|312.481673,182.153113|312.488590,181.689871|312.481427,181.227300|312.463530,180.778293|312.437801,180.352483|312.406717,179.956696|312.372350,179.595386|312.336402,179.271040|312.300240,178.984548|312.264932,178.735534|312.231283,178.522646
3+
ba11410a-5f76-479e-bf37-b80a32043e87;392.000000,94.000000|392.990123,100.930811|391.925635,97.223448|391.424915,100.032976|391.101678,97.519032|390.462788,101.505580|390.919574,106.476751|391.266212,108.169195|391.517856,109.206323|391.340953,110.185572|391.213962,110.801645|391.122439,114.956035|391.353821,114.152431|391.535502,113.438609|391.949610,116.040568|392.020740,118.574446|392.074740,120.549566|392.359304,123.542159|392.353471,126.403898|392.107201,126.807446|392.353806,131.160062|392.790519,130.627929|393.161075,129.991568|393.471670,133.348650|393.728024,132.086040|393.711343,133.521686|393.903814,136.217789|394.057157,137.327026|394.175849,138.152231|394.040748,142.757541|394.578334,146.875245|395.037127,150.303113|394.527690,151.980995|394.956099,155.687916|394.425375,158.940989|395.287148,163.119125|395.587092,166.977610|394.938937,172.323355|395.247886,175.379554|395.510246,177.743357|394.611805,176.821524|395.154121,179.068733|395.628555,180.784977|396.036901,182.040514|396.382415,182.902881|396.669397,183.435601|396.902832,183.697295|397.088101,183.741126|397.230741,183.614522|397.336253,183.359122|397.409955,183.010896|397.456875,182.600398|397.481673,182.153113|397.488590,181.689871|397.481427,181.227300|397.463530,180.778293|397.437801,180.352483|397.406717,179.956696|397.372350,179.595386|397.336402,179.271040|397.300240,178.984548|397.264932,178.735534|397.231283,178.522646
4+
2b1ccc90-7b86-415a-84f5-980b0b6c40d9;222.000000,94.000000|222.990123,100.930811|221.925635,97.223448|221.424915,100.032976|221.101678,97.519032|220.462788,101.505580|220.919574,106.476751|221.266212,108.169195|221.517856,109.206323|221.340953,110.185572|221.213962,110.801645|221.122439,114.956035|221.353821,114.152431|221.535502,113.438609|221.949610,116.040568|222.020740,118.574446|222.074740,120.549566|222.359304,123.542159|222.353471,126.403898|222.107201,126.807446|222.353806,131.160062|222.790519,130.627929|223.161075,129.991568|223.471670,133.348650|223.728024,132.086040|223.711343,133.521686|223.903814,136.217789|224.057157,137.327026|224.175849,138.152231|224.040748,142.757541|224.578334,146.875245|225.037127,150.303113|224.527690,151.980995|224.956099,155.687916|224.425375,158.940989|225.287148,163.119125|225.587092,166.977610|224.938937,172.323355|225.247886,175.379554|225.510246,177.743357|224.611805,176.821524|225.154121,179.068733|225.628555,180.784977|226.036901,182.040514|226.382415,182.902881|226.669397,183.435601|226.902832,183.697295|227.088101,183.741126|227.230741,183.614522|227.336253,183.359122|227.409955,183.010896|227.456875,182.600398|227.481673,182.153113|227.488590,181.689871|227.481427,181.227300|227.463530,180.778293|227.437801,180.352483|227.406717,179.956696|227.372350,179.595386|227.336402,179.271040|227.300240,178.984548|227.264932,178.735534|227.231283,178.522646

data/blobs_bytetrack_spread.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
id;track
2+
8be24575-71af-4813-be9c-b2e68c437905;464.500000,268.500000|464.004951,273.450581|464.003043,278.036284|464.230913,286.350038|464.162218,294.010330|465.897375,303.495010|467.308316,314.497749|466.592426,329.463501|465.855493,340.809821|466.565291,349.866184|468.071886,359.731017|468.854037,368.570750|468.825075,379.069889|468.775620,388.647189|468.307459,398.347595|468.560606,408.011484|468.624432,415.762559|469.025979,424.188056|469.702158,432.449920|470.252498,439.876711|471.042259,446.147190|471.804332,451.792390|473.106860,456.014433
3+
ce8d2daf-cc06-481c-84f7-795fe5015741;186.500000,150.000000|181.549434,151.485180|179.912933,150.155802|178.458485,148.391347|176.813962,166.181001|172.823733,178.210710|167.802060,186.130153|137.218642,232.119702|133.400992,254.043957|129.372239,266.540088|126.596580,274.351364|123.999385,280.839323
4+
df903917-df13-4fc6-95fe-00718dbf6582;772.000000,224.500000|772.990469,224.500124|772.195209,225.578774|775.247668,226.315997|776.449317,241.705677|778.974435,252.766930|781.688886,260.465317|783.219314,266.151348|785.110277,268.627950|785.805579,271.577908|785.377702,272.550347|786.399140,273.779744|786.216920,275.065889
5+
b96a1e1f-56a0-4562-abf8-c55593b83de0;432.500000,29.000000|433.985180,27.019779|433.727432,27.812544|434.062690,28.414910|434.524344,29.492079|435.065588,30.890034|435.200776,32.010961|434.858985,32.708982|434.988828,33.895913|435.355192,40.199483|435.687957,43.560490|435.743248,45.453295|435.781809,47.077214|435.948411,48.097233|435.806217,48.681484

data/draw_tracks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@ def plot_with_suff(suff: str):
3535

3636
plt.clf() # clear figure
3737

38-
plot_with_suff('spread')
39-
plot_with_suff('similar')
38+
# plot_with_suff('spread')
39+
# plot_with_suff('naive')
40+
plot_with_suff('bytetrack_spread')
41+
plot_with_suff('bytetrack_naive')
27.4 KB
Loading
21.8 KB
Loading

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ require (
88
github.com/pkg/errors v0.9.1
99
)
1010

11-
require gonum.org/v1/gonum v0.14.0 // indirect
11+
require (
12+
github.com/arthurkushman/go-hungarian v0.0.0-20210331201642-2b0c3bc2fb3f // indirect
13+
gonum.org/v1/gonum v0.14.0 // indirect
14+
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
44
github.com/LdDl/kalman-filter v0.2.1 h1:+/KSdJJPPO8p+NC8vIl8W6fbumlyOqYTFOGkgaN/iis=
55
github.com/LdDl/kalman-filter v0.2.1/go.mod h1:3zuy/ZAUsDoVpDhCZ/UPjriNnFunwR0DMf6iLDzZ3Cw=
66
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
7+
github.com/arthurkushman/go-hungarian v0.0.0-20210331201642-2b0c3bc2fb3f h1:tDJoVC0qtOexthMxKXJDTOnKasZYKd1wu//Y32I7XmI=
8+
github.com/arthurkushman/go-hungarian v0.0.0-20210331201642-2b0c3bc2fb3f/go.mod h1:2BBHlf6LyLGCh71S3bhUrDUQZJAuTJCqxQyrfhq+1xA=
79
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
810
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
911
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=

0 commit comments

Comments
 (0)