├── .github
├── CODEOWNERS
├── dependabot.yml
└── workflows
│ ├── publish-docs.yml
│ ├── publish-pre-release.yml
│ ├── publish-release.yml
│ ├── test-doc.yml
│ └── uv-test.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── docs
├── assets
│ ├── logo-trackers-black.svg
│ ├── logo-trackers-violet.svg
│ └── logo-trackers-white.svg
├── index.md
├── overrides
│ ├── partials
│ │ └── comments.html
│ └── stylesheets
│ │ └── style.css
└── trackers
│ └── core
│ ├── deepsort
│ └── tracker.md
│ ├── reid
│ └── reid.md
│ └── sort
│ └── tracker.md
├── mkdocs.yml
├── mypy.ini
├── pyproject.toml
├── test
└── core
│ ├── __init__.py
│ └── reid
│ ├── __init__.py
│ └── dataset
│ ├── __init__.py
│ ├── test_base.py
│ └── test_market_1501.py
├── tox.ini
├── trackers
├── __init__.py
├── core
│ ├── __init__.py
│ ├── base.py
│ ├── deepsort
│ │ ├── __init__.py
│ │ ├── kalman_box_tracker.py
│ │ └── tracker.py
│ ├── reid
│ │ ├── __init__.py
│ │ ├── callbacks.py
│ │ ├── dataset
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ ├── market_1501.py
│ │ │ └── utils.py
│ │ ├── metrics.py
│ │ └── model.py
│ └── sort
│ │ ├── __init__.py
│ │ ├── kalman_box_tracker.py
│ │ └── tracker.py
├── log.py
└── utils
│ ├── __init__.py
│ ├── data_utils.py
│ ├── downloader.py
│ ├── sort_utils.py
│ └── torch_utils.py
└── uv.lock
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # These owners will be the default owners for everything in
2 | # the repo. They will be requested for review when someone
3 | # opens a pull request.
4 | * @soumik12345 @SkalskiP @onuralpszr
5 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | # GitHub Actions
4 | - package-ecosystem: "github-actions"
5 | directory: "/"
6 | schedule:
7 | interval: "weekly"
8 | commit-message:
9 | prefix: ⬆️
10 | target-branch: "main"
11 | # Python
12 | - package-ecosystem: "uv"
13 | directory: "/"
14 | schedule:
15 | interval: "daily"
16 | commit-message:
17 | prefix: ⬆️
18 | target-branch: "main"
19 |
--------------------------------------------------------------------------------
/.github/workflows/publish-docs.yml:
--------------------------------------------------------------------------------
1 | name: Build and Publish Docs
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | workflow_dispatch:
8 | release:
9 | types: [published]
10 |
11 | # Ensure only one concurrent deployment
12 | concurrency:
13 | group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.ref}}
14 | cancel-in-progress: true
15 |
16 | # Restrict permissions by default
17 | permissions:
18 | contents: write # Required for committing to gh-pages
19 | pages: write # Required for deploying to Pages
20 | pull-requests: write # Required for PR comments
21 |
22 | jobs:
23 | deploy:
24 | name: Publish Docs
25 | runs-on: ubuntu-latest
26 | timeout-minutes: 10
27 | strategy:
28 | matrix:
29 | python-version: ["3.10"]
30 | steps:
31 | - name: 📥 Checkout the repository
32 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33 | with:
34 | fetch-depth: 0
35 |
36 | - name: 🐍 Install uv and set Python ${{ matrix.python-version }}
37 | uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
38 | with:
39 | python-version: ${{ matrix.python-version }}
40 | activate-environment: true
41 |
42 | - name: 🔑 Create GitHub App token (mkdocs)
43 | id: mkdocs_token
44 | uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
45 | with:
46 | app-id: ${{ secrets.MKDOCS_APP_ID }}
47 | private-key: ${{ secrets.MKDOCS_PEM }}
48 | owner: roboflow
49 | repositories: mkdocs-material-insiders
50 |
51 | - name: 🏗️ Install dependencies
52 | run: |
53 | uv pip install -r pyproject.toml --group docs
54 | # Install mkdocs-material-insiders using the GitHub App token
55 | uv pip install "git+https://roboflow:${{ steps.mkdocs_token.outputs.token }}@github.com/roboflow/mkdocs-material-insiders.git@9.5.49-insiders-4.53.14#egg=mkdocs-material[imaging]"
56 |
57 | - name: ⚙️ Configure git for github-actions
58 | run: |
59 | git config --global user.name "github-actions[bot]"
60 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
61 |
62 | - name: 🚀 Deploy Development Docs
63 | if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
64 | run: |
65 | MKDOCS_GIT_COMMITTERS_APIKEY=${{ secrets.GITHUB_TOKEN }} uv run mike deploy --push develop
66 |
67 | - name: 🚀 Deploy Release Docs
68 | if: github.event_name == 'release' && github.event.action == 'published'
69 | run: |
70 | latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
71 | MKDOCS_GIT_COMMITTERS_APIKEY=${{ secrets.GITHUB_TOKEN }} uv run mike deploy --push --update-aliases $latest_tag latest
72 |
--------------------------------------------------------------------------------
/.github/workflows/publish-pre-release.yml:
--------------------------------------------------------------------------------
1 | name: Publish Trackers Pre-Releases to PyPI
2 |
3 | on:
4 | push:
5 | tags:
6 | - "[0-9]+.[0-9]+[0-9]+.[0-9]+[0-9]+a[0-9]"
7 | - "[0-9]+.[0-9]+[0-9]+.[0-9]+[0-9]+b[0-9]"
8 | - "[0-9]+.[0-9]+[0-9]+.[0-9]+[0-9]+rc[0-9]"
9 | - "[0-9]+.[0-9]+[0-9]+.[0-9]+a[0-9]"
10 | - "[0-9]+.[0-9]+[0-9]+.[0-9]+b[0-9]"
11 | - "[0-9]+.[0-9]+[0-9]+.[0-9]+rc[0-9]"
12 | - "[0-9]+.[0-9]+.[0-9]+a[0-9]"
13 | - "[0-9]+.[0-9]+.[0-9]+b[0-9]"
14 | - "[0-9]+.[0-9]+.[0-9]+rc[0-9]"
15 | workflow_dispatch:
16 |
17 | permissions: {} # Explicitly remove all permissions by default
18 |
19 | jobs:
20 | publish-pre-release:
21 | name: Publish Pre-release Package
22 | runs-on: ubuntu-latest
23 | environment:
24 | name: test
25 | url: https://pypi.org/project/trackers/
26 | timeout-minutes: 10
27 | permissions:
28 | id-token: write # Required for PyPI publishing
29 | contents: read # Required for checkout
30 | strategy:
31 | matrix:
32 | python-version: ["3.10"]
33 | steps:
34 | - name: 📥 Checkout the repository
35 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36 |
37 | - name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
38 | uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
39 | with:
40 | python-version: ${{ matrix.python-version }}
41 | activate-environment: true
42 |
43 | - name: 🏗️ Build source and wheel distributions
44 | run: |
45 | uv pip install -r pyproject.toml --group build
46 | uv build
47 | uv run twine check --strict dist/*
48 |
49 | - name: 🚀 Publish to PyPi
50 | uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
51 | with:
52 | attestations: true
53 |
--------------------------------------------------------------------------------
/.github/workflows/publish-release.yml:
--------------------------------------------------------------------------------
1 | name: Publish Trackers Releases to PyPI
2 |
3 | on:
4 | push:
5 | tags:
6 | - "[0-9]+.[0-9]+[0-9]+.[0-9]+[0-9]"
7 | - "[0-9]+.[0-9]+[0-9]+.[0-9]"
8 | - "[0-9]+.[0-9]+.[0-9]"
9 | workflow_dispatch:
10 |
11 | permissions: {} # Explicitly remove all permissions by default
12 |
13 | jobs:
14 | publish-release:
15 | name: Publish Release Package
16 | runs-on: ubuntu-latest
17 | environment:
18 | name: release
19 | url: https://pypi.org/project/trackers/
20 | timeout-minutes: 10
21 | permissions:
22 | id-token: write # Required for PyPI publishing
23 | contents: read # Required for checkout
24 | strategy:
25 | matrix:
26 | python-version: ["3.10"]
27 | steps:
28 | - name: 📥 Checkout the repository
29 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30 |
31 | - name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
32 | uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
33 | with:
34 | python-version: ${{ matrix.python-version }}
35 | activate-environment: true
36 |
37 | - name: 🏗️ Build source and wheel distributions
38 | run: |
39 | uv pip install -r pyproject.toml --group build
40 | uv build
41 | uv run twine check --strict dist/*
42 |
43 | - name: 🚀 Publish to PyPi
44 | uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
45 | with:
46 | attestations: true
47 |
--------------------------------------------------------------------------------
/.github/workflows/test-doc.yml:
--------------------------------------------------------------------------------
1 | name: 🧪 Docs Test WorkFlow 📚
2 |
3 | on:
4 | pull_request:
5 | branches: [main, develop]
6 |
7 | # Restrict permissions by default
8 | permissions:
9 | contents: read # Required for checkout
10 | checks: write # Required for test reporting
11 |
12 | jobs:
13 | docs-build-test:
14 | name: Test docs build
15 | runs-on: ubuntu-latest
16 | timeout-minutes: 10
17 | strategy:
18 | matrix:
19 | python-version: ["3.10"]
20 | steps:
21 | - name: 📥 Checkout the repository
22 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23 | with:
24 | fetch-depth: 0
25 |
26 | - name: 🐍 Install uv and set Python ${{ matrix.python-version }}
27 | uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
28 | with:
29 | python-version: ${{ matrix.python-version }}
30 | activate-environment: true
31 |
32 | - name: 🏗️ Install dependencies
33 | run: uv pip install -r pyproject.toml --group docs --python-version ${{ matrix.python-version }}
34 |
35 | - name: 🧪 Test Docs Build
36 | run: uv run mkdocs build --verbose
37 |
--------------------------------------------------------------------------------
/.github/workflows/uv-test.yml:
--------------------------------------------------------------------------------
1 | name: 🔧 Pytest/Test Workflow
2 |
3 | on:
4 | pull_request:
5 | branches: [main, develop]
6 |
7 | jobs:
8 | run-tests:
9 | name: Import Test and Pytest Run
10 | timeout-minutes: 10
11 | strategy:
12 | fail-fast: false
13 | matrix:
14 | os: [ubuntu-latest, windows-latest, macos-latest]
15 | python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16 |
17 | runs-on: ${{ matrix.os }}
18 | steps:
19 | - name: 📥 Checkout the repository
20 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21 |
22 | - name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
23 | uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
24 | with:
25 | python-version: ${{ matrix.python-version }}
26 | activate-environment: true
27 | # TODO(https://github.com/astral-sh/setup-uv/issues/226): Remove this.
28 | prune-cache: ${{ matrix.os != 'windows-latest' }}
29 |
30 | - name: 🚀 Install Packages
31 | run: uv pip install -r pyproject.toml --group dev --group docs --extra cpu --extra reid
32 |
33 | - name: 🧪 Run the Import test
34 | run: uv run python -c "import trackers"
35 |
36 | - name: 🧪 Run the Test
37 | run: uv run pytest
38 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | share/python-wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 | MANIFEST
28 |
29 | # Installer logs
30 | pip-log.txt
31 | pip-delete-this-directory.txt
32 |
33 | # Unit test / coverage reports
34 | htmlcov/
35 | .tox/
36 | .nox/
37 | .coverage
38 | .coverage.*
39 | .cache
40 | nosetests.xml
41 | coverage.xml
42 | *.cover
43 | *.py,cover
44 | .hypothesis/
45 | .pytest_cache/
46 | cover/
47 |
48 | # Translations
49 | *.mo
50 | *.pot
51 |
52 | # Django stuff:
53 | *.log
54 | local_settings.py
55 | db.sqlite3
56 | db.sqlite3-journal
57 |
58 | # Flask stuff:
59 | instance/
60 | .webassets-cache
61 |
62 | # Scrapy stuff:
63 | .scrapy
64 |
65 | # Sphinx documentation
66 | docs/_build/
67 |
68 | # PyBuilder
69 | .pybuilder/
70 | target/
71 |
72 | # Jupyter Notebook
73 | .ipynb_checkpoints
74 |
75 | # IPython
76 | profile_default/
77 | ipython_config.py
78 |
79 | # pyenv
80 | # For a library or package, you might want to ignore these files since the code is
81 | # intended to run in multiple environments; otherwise, check them in:
82 | # .python-version
83 |
84 | # pipenv
85 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
86 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
87 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
88 | # install all needed dependencies.
89 | #Pipfile.lock
90 |
91 | # UV
92 | # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
93 | # This is especially recommended for binary packages to ensure reproducibility, and is more
94 | # commonly ignored for libraries.
95 | #uv.lock
96 |
97 | # poetry
98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99 | # This is especially recommended for binary packages to ensure reproducibility, and is more
100 | # commonly ignored for libraries.
101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102 | #poetry.lock
103 |
104 | # pdm
105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106 | #pdm.lock
107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108 | # in version control.
109 | # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110 | .pdm.toml
111 | .pdm-python
112 | .pdm-build/
113 |
114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115 | __pypackages__/
116 |
117 |
118 | # Environments
119 | .env
120 | .venv
121 | env/
122 | venv/
123 | ENV/
124 | env.bak/
125 | venv.bak/
126 |
127 |
128 | # Spyder project settings
129 | .spyderproject
130 | .spyproject
131 |
132 | # Rope project settings
133 | .ropeproject
134 |
135 | # mkdocs documentation
136 | /site
137 |
138 | # mypy
139 | .mypy_cache/
140 | .dmypy.json
141 | dmypy.json
142 |
143 | # Pyre type checker
144 | .pyre/
145 |
146 | # pytype static type analyzer
147 | .pytype/
148 |
149 | # Cython debug symbols
150 | cython_debug/
151 |
152 | # PyCharm
153 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
154 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
155 | # and can be added to the global gitignore or merged into this file. For a more nuclear
156 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
157 | #.idea/
158 |
159 | # Ruff stuff:
160 | .ruff_cache/
161 |
162 | # PyPI configuration file
163 | .pypirc
164 |
165 | # Repository-specific stuff
166 | .ipynb_checkpoints/
167 | .idea/
168 | test.py
169 | **.pt
170 | **.pth
171 | .DS_Store
172 | data/
173 | logs/
174 | runs/
175 | wandb/
176 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 |
2 | ci:
3 | autofix_prs: true
4 | autoupdate_schedule: weekly
5 | autofix_commit_msg: "fix(pre_commit): 🎨 auto format pre-commit hooks"
6 | autoupdate_commit_msg: "chore(pre_commit): ⬆ pre_commit autoupdate"
7 |
8 | repos:
9 | - repo: https://github.com/pre-commit/pre-commit-hooks
10 | rev: v5.0.0
11 | hooks:
12 | - id: trailing-whitespace
13 | exclude: test/.*\.py
14 | - id: check-executables-have-shebangs
15 | - id: check-toml
16 | - id: check-case-conflict
17 | - id: check-added-large-files
18 | - id: detect-private-key
19 | - id: pretty-format-json
20 | args: ['--autofix', '--no-sort-keys', '--indent=4']
21 | exclude: /.*\.ipynb
22 | - id: end-of-file-fixer
23 | - id: mixed-line-ending
24 |
25 | - repo: https://github.com/PyCQA/bandit
26 | rev: '1.8.3'
27 | hooks:
28 | - id: bandit
29 | args: ["-c", "pyproject.toml"]
30 | additional_dependencies: ["bandit[toml]"]
31 |
32 | - repo: https://github.com/astral-sh/ruff-pre-commit
33 | rev: v0.11.12
34 | hooks:
35 | - id: ruff
36 | args: [--fix, --exit-non-zero-on-fix]
37 | - id: ruff-format
38 | types_or: [ python, pyi, jupyter]
39 |
40 | - repo: https://github.com/pre-commit/mirrors-mypy
41 | rev: 'v1.16.0'
42 | hooks:
43 | - id: mypy
44 | additional_dependencies: [numpy,types-aiofiles]
45 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socioeconomic status,
9 | nationality, personal appearance, race, caste, color, religion, or sexual
10 | identity and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | - Demonstrating empathy and kindness toward other people
21 | - Being respectful of differing opinions, viewpoints, and experiences
22 | - Giving and gracefully accepting constructive feedback
23 | - Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | - Focusing on what is best not just for us as individuals, but for the overall
26 | community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | - The use of sexualized language or imagery, and sexual attention or advances of
31 | any kind
32 | - Trolling, insulting or derogatory comments, and personal or political attacks
33 | - Public or private harassment
34 | - Publishing others' private information, such as a physical or email address,
35 | without their explicit permission
36 | - Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | community-reports@roboflow.com.
64 |
65 | All complaints will be reviewed and investigated promptly and fairly.
66 |
67 | All community leaders are obligated to respect the privacy and security of the
68 | reporter of any incident.
69 |
70 | ## Enforcement Guidelines
71 |
72 | Community leaders will follow these Community Impact Guidelines in determining
73 | the consequences for any action they deem in violation of this Code of Conduct:
74 |
75 | ### 1. Correction
76 |
77 | **Community Impact**: Use of inappropriate language or other behavior deemed
78 | unprofessional or unwelcome in the community.
79 |
80 | **Consequence**: A private, written warning from community leaders, providing
81 | clarity around the nature of the violation and an explanation of why the
82 | behavior was inappropriate. A public apology may be requested.
83 |
84 | ### 2. Warning
85 |
86 | **Community Impact**: A violation through a single incident or series of
87 | actions.
88 |
89 | **Consequence**: A warning with consequences for continued behavior. No
90 | interaction with the people involved, including unsolicited interaction with
91 | those enforcing the Code of Conduct, for a specified period of time. This
92 | includes avoiding interactions in community spaces as well as external channels
93 | like social media. Violating these terms may lead to a temporary or permanent
94 | ban.
95 |
96 | ### 3. Temporary Ban
97 |
98 | **Community Impact**: A serious violation of community standards, including
99 | sustained inappropriate behavior.
100 |
101 | **Consequence**: A temporary ban from any sort of interaction or public
102 | communication with the community for a specified period of time. No public or
103 | private interaction with the people involved, including unsolicited interaction
104 | with those enforcing the Code of Conduct, is allowed during this period.
105 | Violating these terms may lead to a permanent ban.
106 |
107 | ### 4. Permanent Ban
108 |
109 | **Community Impact**: Demonstrating a pattern of violation of community
110 | standards, including sustained inappropriate behavior, harassment of an
111 | individual, or aggression toward or disparagement of classes of individuals.
112 |
113 | **Consequence**: A permanent ban from any sort of public interaction within the
114 | community.
115 |
116 | ## Attribution
117 |
118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119 | version 2.1, available at
120 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121 |
122 | Community Impact Guidelines were inspired by
123 | [Mozilla's code of conduct enforcement ladder][mozilla coc].
124 |
125 | For answers to common questions about this code of conduct, see the FAQ at
126 | [https://www.contributor-covenant.org/faq][faq]. Translations are available at
127 | [https://www.contributor-covenant.org/translations][translations].
128 |
129 | [faq]: https://www.contributor-covenant.org/faq
130 | [homepage]: https://www.contributor-covenant.org
131 | [mozilla coc]: https://github.com/mozilla/diversity
132 | [translations]: https://www.contributor-covenant.org/translations
133 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
134 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Trackers
2 |
3 | Thank you for your interest in contributing to the Trackers library! Your help—whether it’s fixing bugs, improving documentation, or adding new algorithms—is essential to the success of the project. We’re building this library with the goal of making state-of-the-art object tracking accessible under a fully open license.
4 |
5 | ## Table of Contents
6 |
7 | 1. [How to Contribute](#how-to-contribute)
8 | 2. [CLA Signing](#cla-signing)
9 | 3. [Clean Room Requirements](#clean-room-requirements)
10 | 4. [Google-Style Docstrings and Type Hints](#google-style-docstrings-and-type-hints)
11 | 5. [Reporting Bugs](#reporting-bugs)
12 | 6. [License](#license)
13 |
14 | ## How to Contribute
15 |
16 | Contributions come in many forms: improving features, fixing bugs, suggesting ideas, improving documentation, or adding new tracking methods. Here’s a high-level overview to get you started:
17 |
18 | 1. [Fork the Repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo): Click the “Fork” button on our GitHub page to create your own copy.
19 | 2. [Clone Locally](https://docs.github.com/en/enterprise-server@3.11/repositories/creating-and-managing-repositories/cloning-a-repository): Download your fork to your local development environment.
20 | 3. [Create a Branch](https://docs.github.com/en/desktop/making-changes-in-a-branch/managing-branches-in-github-desktop): Use a descriptive name to create a new branch:
21 |
22 | ```bash
23 | git checkout -b feature/your-descriptive-name
24 | ```
25 |
26 | 4. Develop Your Changes: Make your updates, ensuring your commit messages clearly describe your modifications.
27 | 5. [Commit and Push](https://docs.github.com/en/desktop/making-changes-in-a-branch/committing-and-reviewing-changes-to-your-project-in-github-desktop): Run:
28 |
29 | ```bash
30 | git add .
31 | git commit -m "A brief description of your changes"
32 | git push -u origin your-descriptive-name
33 | ```
34 |
35 | 6. [Open a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request): Submit your pull request against the main development branch. Please detail your changes and link any related issues.
36 |
37 | Before merging, check that all tests pass and that your changes adhere to our development and documentation standards.
38 |
39 | ## CLA Signing
40 |
41 | In order to maintain the integrity of our project, every pull request must include a signed Contributor License Agreement (CLA). This confirms that your contributions are properly licensed under our Apache 2.0 License. After opening your pull request, simply add a comment stating:
42 |
43 | ```
44 | I have read the CLA Document and I sign the CLA.
45 | ```
46 |
47 | This step is essential before any merge can occur.
48 |
49 | ## Clean Room Requirements
50 |
51 | Trackers package is developed under the Apache 2.0 license, which allows for wide adoption, commercial use, and integration with other open-source tools. However, many object tracking methods released alongside academic papers are published under more restrictive licenses (GPL, AGPL, etc.), which limit redistribution or usage in commercial contexts.
52 |
53 | To ensure Trackers remains fully open and legally safe to use:
54 |
55 | - All algorithms must be clean room re-implementations, meaning they are developed from scratch without referencing restricted source code.
56 | - You must not copy, adapt, or even consult source code under restrictive licenses.
57 |
58 | You can use the following as reference:
59 |
60 | - The original academic papers that describe the algorithm.
61 | - Existing implementations released under permissive open-source licenses (Apache 2.0, MIT, BSD, etc.).
62 |
63 | If in doubt about whether a license is compatible, please ask before proceeding. By contributing to this project and signing the CLA, you confirm that your work complies with these guidelines and that you understand the importance of maintaining a clean licensing chain.
64 |
65 | ## Google-Style Docstrings and Type Hints
66 |
67 | For clarity and maintainability, any new functions or classes must include [Google-style docstrings](https://google.github.io/styleguide/pyguide.html) and use Python type hints. Type hints are mandatory in all function definitions, ensuring explicit parameter and return type declarations. These docstrings should clearly explain parameters, return types, and provide usage examples when applicable.
68 |
69 | For example:
70 |
71 | ```python
72 | def sample_function(param1: int, param2: int = 10) -> bool:
73 | """
74 | Provides a brief description of function behavior.
75 |
76 | Args:
77 | param1 (int): Explanation of the first parameter.
78 | param2 (int): Explanation of the second parameter, defaulting to 10.
79 |
80 | Returns:
81 | bool: True if the operation succeeds, otherwise False.
82 |
83 | Examples:
84 | >>> sample_function(5, 10)
85 | True
86 | """
87 | return param1 == param2
88 | ```
89 |
90 | Following this pattern helps ensure consistency throughout the codebase.
91 |
92 | ## Reporting Bugs
93 |
94 | Bug reports are vital for continued improvement. When reporting an issue, please include a clear, minimal reproducible example that demonstrates the problem. Detailed bug reports assist us in swiftly diagnosing and addressing issues.
95 |
96 | ## License
97 |
98 | By contributing to Trackers, you agree that your contributions will be licensed under the Apache 2.0 License as specified in our [LICENSE](/LICENSE) file.
99 |
100 | Thank you for helping us build a reliable, open-source tracking library. We’re excited to collaborate with you!
101 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
13 |
14 | ## Hello
15 |
16 | `trackers` is a unified library offering clean room re-implementations of leading multi-object tracking algorithms. Its modular design allows you to easily swap trackers and integrate them with object detectors from various libraries like `inference`, `ultralytics`, or `transformers`.
17 |
18 |
19 |
20 |
21 |
22 |
Tracker
23 |
Paper
24 |
MOTA
25 |
Year
26 |
Status
27 |
Colab
28 |
29 |
30 |
31 |
32 |
SORT
33 |
34 |
74.6
35 |
2016
36 |
✅
37 |
38 |
39 |
40 |
DeepSORT
41 |
42 |
75.4
43 |
2017
44 |
✅
45 |
46 |
47 |
48 |
ByteTrack
49 |
50 |
77.8
51 |
2021
52 |
🚧
53 |
🚧
54 |
55 |
56 |
OC-SORT
57 |
58 |
75.9
59 |
2022
60 |
🚧
61 |
🚧
62 |
63 |
64 |
BoT-SORT
65 |
66 |
77.8
67 |
2022
68 |
🚧
69 |
🚧
70 |
71 |
72 |
73 |
74 |
75 | https://github.com/user-attachments/assets/eef9b00a-cfe4-40f7-a495-954550e3ef1f
76 |
77 | ## Installation
78 |
79 | Pip install the `trackers` package in a [**Python>=3.9**](https://www.python.org/) environment.
80 |
81 | ```bash
82 | pip install trackers
83 | ```
84 |
85 |
86 | install from source
87 |
88 |
89 |
90 | By installing `trackers` from source, you can explore the most recent features and enhancements that have not yet been officially released. Please note that these updates are still in development and may not be as stable as the latest published release.
91 |
92 | ```bash
93 | pip install git+https://github.com/roboflow/trackers.git
94 | ```
95 |
96 |
97 |
98 | ## Quickstart
99 |
100 | With a modular design, `trackers` lets you combine object detectors from different libraries with the tracker of your choice. Here's how you can use `SORTTracker` with various detectors:
101 |
102 | ```python
103 | import supervision as sv
104 | from trackers import SORTTracker
105 | from inference import get_model
106 |
107 | tracker = SORTTracker()
108 | model = get_model(model_id="yolov11m-640")
109 | annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER)
110 |
111 | def callback(frame, _):
112 | result = model.infer(frame)[0]
113 | detections = sv.Detections.from_inference(result)
114 | detections = tracker.update(detections)
115 | return annotator.annotate(frame, detections, labels=detections.tracker_id)
116 |
117 | sv.process_video(
118 | source_path="",
119 | target_path="",
120 | callback=callback,
121 | )
122 | ```
123 |
124 |
125 | run with ultralytics
126 |
127 |
128 |
129 | ```python
130 | import supervision as sv
131 | from trackers import SORTTracker
132 | from ultralytics import YOLO
133 |
134 | tracker = SORTTracker()
135 | model = YOLO("yolo11m.pt")
136 | annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER)
137 |
138 | def callback(frame, _):
139 | result = model(frame)[0]
140 | detections = sv.Detections.from_ultralytics(result)
141 | detections = tracker.update(detections)
142 | return annotator.annotate(frame, detections, labels=detections.tracker_id)
143 |
144 | sv.process_video(
145 | source_path="",
146 | target_path="",
147 | callback=callback,
148 | )
149 | ```
150 |
151 |
152 |
153 |
154 | run with transformers
155 |
156 |
157 |
158 | ```python
159 | import torch
160 | import supervision as sv
161 | from trackers import SORTTracker
162 | from transformers import RTDetrV2ForObjectDetection, RTDetrImageProcessor
163 |
164 | tracker = SORTTracker()
165 | image_processor = RTDetrImageProcessor.from_pretrained("PekingU/rtdetr_v2_r18vd")
166 | model = RTDetrV2ForObjectDetection.from_pretrained("PekingU/rtdetr_v2_r18vd")
167 | annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER)
168 |
169 | def callback(frame, _):
170 | inputs = image_processor(images=frame, return_tensors="pt")
171 | with torch.no_grad():
172 | outputs = model(**inputs)
173 |
174 | h, w, _ = frame.shape
175 | results = image_processor.post_process_object_detection(
176 | outputs,
177 | target_sizes=torch.tensor([(h, w)]),
178 | threshold=0.5
179 | )[0]
180 |
181 | detections = sv.Detections.from_transformers(
182 | transformers_results=results,
183 | id2label=model.config.id2label
184 | )
185 |
186 | detections = tracker.update(detections)
187 | return annotator.annotate(frame, detections, labels=detections.tracker_id)
188 |
189 | sv.process_video(
190 | source_path="",
191 | target_path="",
192 | callback=callback,
193 | )
194 | ```
195 |
196 |
197 |
198 | ## License
199 |
200 | The code is released under the [Apache 2.0 license](https://github.com/roboflow/trackers/blob/main/LICENSE).
201 |
202 | ## Contribution
203 |
204 | We welcome all contributions—whether it’s reporting issues, suggesting features, or submitting pull requests. Please read our [contributor guidelines](https://github.com/roboflow/trackers/blob/main/CONTRIBUTING.md) to learn about our processes and best practices.
205 |
--------------------------------------------------------------------------------
/docs/assets/logo-trackers-black.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/docs/assets/logo-trackers-violet.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/docs/assets/logo-trackers-white.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | comments: true
3 | ---
4 |
5 |
18 |
19 | `trackers` is a unified library offering clean room re-implementations of leading multi-object tracking algorithms. Its modular design allows you to easily swap trackers and integrate them with object detectors from various libraries like `inference`, `ultralytics`, or `transformers`.
20 |
21 |