Skip to content

Commit 9cb1581

Browse files
committed
Initial commit
1 parent b639e68 commit 9cb1581

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+7450
-2
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "src/cpputils/fuzzylite"]
2+
path = src/cpputils/fuzzylite
3+
url = https://github.com/fuzzylite/fuzzylite.git
4+
[submodule "src/cpputils/pybind11"]
5+
path = src/cpputils/pybind11
6+
url = https://github.com/pybind/pybind11.git

README.md

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,93 @@
1-
# VisualRFS
2-
This is the official Python and C++ implementation repository for a paper entitled "Visual multi-object tracking with re-identification and occlusion handling using labeled random finite sets", Pattern Recognition (https://arxiv.org/pdf/2407.08872).
1+
# Visual RFS
2+
3+
This is the official Python and C++ implementation repository for a paper entitled "Visual Multi-Object Tracking with Re-Identification and Occlusion Handling using Labeled Random Finite Sets", *Pattern Recognition* ([arXiv 2405.18606](http://arxiv.org/abs/2405.18606)), ([MOTChallenge](https://motchallenge.net/method/MOT=8697&chl=5)).
4+
5+
6+
![](tracker_diagram.png)
7+
8+
### Quick Overview
9+
- Exploiting object feature improves tracking performance of labeled random finite set filters (GLMB and LMB filters) by improving data association.
10+
- Using object deep feature is effective for re-ID tasks.
11+
- Fuzzy occlusion handling model improves tracking performance.
12+
13+
### Docker image
14+
Docker image to run VisualRFS codes can be found in [Docker Hub]().
15+
16+
### Usage
17+
1. **Set Up Python Environment**
18+
- Create a `conda` Python environment and activate it:
19+
```sh
20+
conda create --name virtualenv python==3.7.16
21+
conda activate virtualenv
22+
```
23+
- Clone this repository recursively to have **fuzzylite**, and **pybind11**
24+
```sh
25+
git clone --recursive https://github.com/linh-gist/visualrfs.git
26+
```
27+
28+
2. **Install Packages**
29+
- C++ Packages ([Make sure `Eigen 3.4.0` is installed](src/cpputils/README.md)): Navigate to the `src/cpputils` folder and run `python setup.py build develop`
30+
- Python Packages: `pip install -r requirements.txt`
31+
32+
3. **Configure Experiment Options**
33+
Change the following options when initializing `GLMB` or `LMB` tracker
34+
- C++ `GLMB(int width, int height, bool useFeat = true, bool useFuzzyPD = false)`
35+
- C++ `LMB(int width, int height, bool useFeat = true, bool useFuzzyPD = false)`
36+
- Python `LMB: def __init__(self, use_feat=True)`
37+
- Python `GLMB: def __init__(self, width, height, use_feat=True)`
38+
39+
4. **Prepare Data**
40+
- Datasets:
41+
- MOTChallenge datasets ([MOT16](https://motchallenge.net/data/MOT16/), [MOT17](https://motchallenge.net/data/MOT17/), [MOT20](https://motchallenge.net/data/MOT20/))
42+
- You can run on your own dataset with your preference object detector
43+
- Folder structure:
44+
```
45+
|-- detection
46+
| |-- detector_fairmot256
47+
| | |-- MOT16-01.npz
48+
| | |-- MOT16-02.npz
49+
| | | ...
50+
| | |-- MOT16-14.npz
51+
| |-- detector_fairmot256
52+
| | |-- MOT20-01.npz
53+
| | |-- ...
54+
| | |-- MOT20-08.npz
55+
|-- src
56+
| |-- cpputils
57+
| |-- joint_glmb
58+
| |-- joint_lmb
59+
| |-- tracking_utils
60+
|-- requirements.txt
61+
|-- README.md
62+
```
63+
- OSPA2 is re-implemented in Python and following this paper, an example code is given in `ospa2.py`.
64+
```
65+
@article{rezatofighi2020trustworthy,
66+
title={How trustworthy are the existing performance evaluations for basic vision tasks?},
67+
author={Tran Thien Dat Nguyen and Hamid Rezatofighi and Ba-Ngu Vo and Ba-Tuong Vo and Silvio Savarese and Ian Reid},
68+
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
69+
year={2022}
70+
}
71+
```
72+
73+
5. **Run the Tracking Demo**
74+
- Navigate to the [`joint_glmb`](src/joint_glmb) or [`joint_lmb`](src/joint_lmb) and run `python run_joint_glmb.py` OR `python run_joint_lmb.py`.
75+
76+
77+
78+
### Contact
79+
Linh Ma (linh.mavan@gm.gist.ac.kr), Machine Learning & Vision Laboratory, GIST, South Korea
80+
81+
### Citation
82+
If you find this project useful in your research, please consider citing by:
83+
84+
```
85+
@article{linh2024inffus,
86+
title={Visual Multi-Object Tracking with Re-Identification and Occlusion Handling using Labeled Random Finite Sets},
87+
author={Linh~Van~Ma and Tran~Thien~Dat~Nguyen and Changbeom~Shim and Du~Yong~Kim and Namkoo~Ha and Moongu~Jeon},
88+
journal={Pattern Recognition},
89+
volume = {156},
90+
year={2024},
91+
publisher={Elsevier}
92+
}
93+
```

detection/detector_fairmot256/README

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Put detection of FairMOT with Re-Identification feature 256 dimension in this folder.
2+
3+
@article{zhang2021fairmot,
4+
title={Fairmot: On the fairness of detection and re-identification in multiple object tracking},
5+
author={Zhang, Yifu and Wang, Chunyu and Wang, Xinggang and Zeng, Wenjun and Liu, Wenyu},
6+
journal={International journal of computer vision},
7+
volume={129},
8+
pages={3069--3087},
9+
year={2021},
10+
publisher={Springer}
11+
}
12+
13+
Detection files are Numpy files
14+
15+
MOT16-01.npz MOT16-04.npz MOT16-07.npz MOT16-10.npz MOT16-13.npz
16+
MOT16-02.npz MOT16-05.npz MOT16-08.npz MOT16-11.npz MOT16-14.npz
17+
MOT16-03.npz MOT16-06.npz MOT16-09.npz MOT16-12.npz
18+
19+
The detection file stores information about the detected bounding boxes, including the coordinates
20+
(Top, Left, Bottom, Right) and the confidence score of each detection.
21+
It stores re-identification data linked to the corresponding bounding boxes.
22+
23+
Below is an example of how this information is structured:
24+
dict_detect[str(self.frame_id) + '_det'] = np.copy(dets)
25+
dict_detect[str(self.frame_id) + '_feat'] = np.copy(id_feature)
26+
27+
0000 = {str} '0_det'
28+
0001 = {str} '0_feat'
29+
0002 = {str} '1_det'
30+
0003 = {str} '1_feat'
31+
0004 = {str} '2_det'
32+
0005 = {str} '2_feat'
33+
0006 = {str} '3_det'
34+
0007 = {str} '3_feat'
35+
0008 = {str} '4_det'
36+
0009 = {str} '4_feat'
37+
0010 = {str} '5_det'
38+
0011 = {str} '5_feat'
39+
0012 = {str} '6_det'
40+
0013 = {str} '6_feat'
41+
0014 = {str} '7_det'
42+
0015 = {str} '7_feat'

detection/detector_gsdt/README

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Put detection of GSDT with Re-Identification feature 512 dimension in this folder.
2+
3+
@inproceedings{wang2021joint,
4+
title={Joint object detection and multi-object tracking with graph neural networks},
5+
author={Wang, Yongxin and Kitani, Kris and Weng, Xinshuo},
6+
booktitle={2021 IEEE international conference on robotics and automation (ICRA)},
7+
pages={13708--13715},
8+
year={2021},
9+
organization={IEEE}
10+
}
11+
12+
Detection files are Numpy files
13+
14+
MOT20-01.npz MOT20-03.npz MOT20-05.npz MOT20-07.npz
15+
MOT20-02.npz MOT20-04.npz MOT20-06.npz MOT20-08.npz
16+
17+
The detection file stores information about the detected bounding boxes, including the coordinates
18+
(Top, Left, Bottom, Right) and the confidence score of each detection.
19+
It stores re-identification data linked to the corresponding bounding boxes.
20+
21+
Below is an example of how this information is structured:
22+
dict_detect[str(self.frame_id) + '_det'] = np.copy(dets)
23+
dict_detect[str(self.frame_id) + '_feat'] = np.copy(id_feature)
24+
25+
0000 = {str} '0_det'
26+
0001 = {str} '0_feat'
27+
0002 = {str} '1_det'
28+
0003 = {str} '1_feat'
29+
0004 = {str} '2_det'
30+
0005 = {str} '2_feat'
31+
0006 = {str} '3_det'
32+
0007 = {str} '3_feat'
33+
0008 = {str} '4_det'
34+
0009 = {str} '4_feat'
35+
0010 = {str} '5_det'
36+
0011 = {str} '5_feat'
37+
0012 = {str} '6_det'
38+
0013 = {str} '6_feat'
39+
0014 = {str} '7_det'
40+
0015 = {str} '7_feat'

requirements.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
numpy==1.21.6
2+
h5py==3.1.0
3+
motmetrics==1.4.0
4+
pandas==1.3.5
5+
matplotlib==3.4.1
6+
packaging==24.0
7+
protobuf==4.24.4
8+
opencv-python==3.4.18.65
9+
lap==0.4.0
10+
openpyxl==3.0.10

src/cpputils/CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cmake_minimum_required (VERSION 3.3)
2+
project (cpputils)
3+
4+
add_subdirectory(pybind11)
5+
6+
##### Murty
7+
#find_package (Eigen3 3.3 REQUIRED NO_MODULE)
8+
SET( EIGEN3_INCLUDE_DIR "/media/ubuntu/2715608D71CBF6FC/eigen-3.4.0" )
9+
IF( NOT EIGEN3_INCLUDE_DIR )
10+
MESSAGE( FATAL_ERROR "Please point the environment variable EIGEN3_INCLUDE_DIR to the include directory of your Eigen3 installation.")
11+
ENDIF()
12+
INCLUDE_DIRECTORIES ( "${EIGEN3_INCLUDE_DIR}" )
13+
14+
##### Fuzzy
15+
include_directories (./fuzzylite/fuzzylite)
16+
link_directories(./fuzzylite/fuzzylite/release/bin)
17+
18+
##### OpenMP
19+
# find_package(OpenMP)
20+
# if (OPENMP_FOUND)
21+
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
22+
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
23+
# set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
24+
# endif()
25+
26+
# Set the C++ standard to C++17
27+
set(CMAKE_CXX_STANDARD 17)
28+
set(CMAKE_CXX_STANDARD_REQUIRED True)
29+
30+
pybind11_add_module(cpputils src/main.cpp)
31+
target_link_libraries(cpputils PRIVATE fuzzylite-static)

src/cpputils/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
### Python wrapper for c++ implemented murty, gibbs, fuzzy, bbox overlap, esf, etc,.
2+
3+
------------------------------------
4+
How to install this Python Wrapper
5+
1) Clone FuzzyLite: `git clone https://github.com/fuzzylite/fuzzylite.git`
6+
`cd fuzzylite`, `git checkout 5e8a1015e529ebba5a3d19430a05e51eef5f4a8b`
7+
You can also configure FuzzyLite with it latest code but need to configure `CMakeLists.txt`
8+
2) Clone Pybind11: `git clone https://github.com/pybind/pybind11.git`
9+
3) _Build FuzzyLite_
10+
1. Build your own FIS in Matlab, export to *.fis file, and copy to `tests` folder. You can also customize FIS in `build_engine()`, `fuzzy.hpp`. However, Matlab Fuzzy Logic Designer would be an easy tool to build and visualize your FIS.
11+
2. Build fuzzylite first to get static library in `./fuzzylite/release/bin`:
12+
`cd fuzzylite` => `./build.sh` or `build.bat` in Windows.
13+
4) Move to the root folder and run: `python setup.py build develop`
14+
15+
------------------------------------
16+
Notes:
17+
1) If you have a problem while building `fuzzylite` in Windows, e.g. _The C compiler is not able to compile a simple test program_,
18+
2) run this command on your terminal `vcvarsall.bat x64`. Specify your Windows Platform by `x86_amd64`, `x64`, etc.
19+
3) Path example: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64`
20+
21+
Install Eigen for Windows (after the following steps, add include directory `C:\eigen-3.4.0` for example.)
22+
1) Download Eigen 3.4.0 (NOT lower than this version) from it official website https://eigen.tuxfamily.org/ or [ZIP file here](https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip).
23+
2) `mkdir build_dir`
24+
3) `cd build_dir`
25+
4) `cmake ../`
26+
5) `make install`, this step does not require
27+
28+
Install Eigen for Linux
29+
1) [install and use eigen3 on ubuntu 16.04](https://kezunlin.me/post/d97b21ee/)
30+
2) `sudo apt-get install libeigen3-dev` libeigen3-dev is installed install to `/usr/include/eigen3/` and `/usr/lib/cmake/eigen3`.
31+
3) Thus, we must make a change in **CMakeLists.txt** `SET( EIGEN3_INCLUDE_DIR "/usr/local/include/eigen3" )` to `SET( EIGEN3_INCLUDE_DIR "/usr/include/eigen3/" )`.
32+
33+
Murty Implementations
34+
1) [headers/murty.hpp] https://github.com/jonatanolofsson/mht/tree/master/murty
35+
2) [headers/MurtyMiller.hpp] https://github.com/jonatanolofsson/MurtyAlgorithm
36+
3) https://github.com/fbaeuerlein/MurtyAlgorithm
37+
4) https://github.com/motrom/fastmurty
38+
5) https://github.com/gatagat/lap
39+
40+
### Contact
41+
Linh Ma (linh.mavan@gm.gist.ac.kr), Machine Learning & Vision Laboratory, GIST, South Korea
42+
43+
### Citation
44+
If you find this project useful in your research, please consider citing by:
45+
46+
```
47+
@article{linh2024inffus,
48+
title={Visual Multi-Object Tracking with Re-Identification and Occlusion Handling using Labeled Random Finite Sets},
49+
author={Linh~Van~Ma and Tran~Thien~Dat~Nguyen and Changbeom~Shim and Du~Yong~Kim and Namkoo~Ha and Moongu~Jeon},
50+
journal={Pattern Recognition},
51+
volume = {156},
52+
year={2024},
53+
publisher={Elsevier}
54+
}
55+
```

src/cpputils/fuzzylite

Submodule fuzzylite added at 03d99e4

src/cpputils/pybind11

Submodule pybind11 added at 66c3774

src/cpputils/setup.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
"""A setuptools based setup module.
2+
3+
See:
4+
https://packaging.python.org/en/latest/distributing.html
5+
https://github.com/pypa/sampleproject
6+
"""
7+
8+
# Always prefer setuptools over distutils
9+
from setuptools import setup, find_packages
10+
# To use a consistent encoding
11+
from codecs import open
12+
import os
13+
import re
14+
import sys
15+
import platform
16+
import subprocess
17+
from setuptools import setup, Extension
18+
from setuptools.command.build_ext import build_ext
19+
from distutils.version import LooseVersion
20+
21+
here = os.path.abspath(os.path.dirname(__file__))
22+
23+
24+
class CMakeExtension(Extension):
25+
def __init__(self, name, sourcedir=''):
26+
Extension.__init__(self, name, sources=[])
27+
self.sourcedir = os.path.abspath(sourcedir)
28+
29+
30+
class CMakeBuild(build_ext):
31+
def run(self):
32+
try:
33+
out = subprocess.check_output(['cmake', '--version'])
34+
except OSError:
35+
raise RuntimeError("CMake must be installed to build the following extensions: " +
36+
", ".join(e.name for e in self.extensions))
37+
38+
if platform.system() == "Windows":
39+
cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1))
40+
if cmake_version < '3.1.0':
41+
raise RuntimeError("CMake >= 3.1.0 is required on Windows")
42+
43+
for ext in self.extensions:
44+
self.build_extension(ext)
45+
46+
def build_extension(self, ext):
47+
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
48+
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
49+
'-DPYTHON_EXECUTABLE=' + sys.executable]
50+
51+
cfg = 'Release'
52+
build_args = ['--config', cfg]
53+
54+
if platform.system() == "Windows":
55+
cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)]
56+
if sys.maxsize > 2 ** 32:
57+
cmake_args += ['-A', 'x64']
58+
build_args += ['--', '/m']
59+
else:
60+
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
61+
build_args += ['--', '-j2']
62+
63+
env = os.environ.copy()
64+
env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''),
65+
self.distribution.get_version())
66+
if not os.path.exists(self.build_temp):
67+
os.makedirs(self.build_temp)
68+
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
69+
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
70+
71+
72+
setup(
73+
name='cpputils',
74+
version='1.0.0',
75+
76+
description='build wrapper for murty, gibbs, fuzzy, bbox overlap, etc,.',
77+
78+
# The project's main homepage.
79+
url='',
80+
81+
# Author details
82+
author='Linh',
83+
author_email='@gist.ac.kr',
84+
85+
# Choose your license
86+
license='GPLv3',
87+
88+
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
89+
classifiers=[
90+
'Development Status :: 4 - Beta',
91+
'Programming Language :: Python :: 3.8',
92+
],
93+
94+
# What does your project relate to?
95+
keywords='murty, gibbs, fuzzy, bbox overlap, pybind11',
96+
ext_modules=[CMakeExtension('cmake_example')],
97+
cmdclass=dict(build_ext=CMakeBuild),
98+
# You can just specify the packages manually here if your project is
99+
# simple. Or you can use find_packages().
100+
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
101+
)

0 commit comments

Comments
 (0)