-
Notifications
You must be signed in to change notification settings - Fork 400
feat(reid): appearance ReID association via standalone reid package #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AlexBodner
wants to merge
101
commits into
develop
Choose a base branch
from
feat/core/reid-consume-reid-package
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 56 commits
Commits
Show all changes
101 commits
Select commit
Hold shift + click to select a range
daea238
feat(reid): add roboflow-reid extra and numpy-only association glue
AlexBodner 8d8faf7
feat(reid): wire BoT-SORT appearance association, CLI, docs, and tests
AlexBodner fbbe664
refactor(reid): L2-normalize FeatureBank EMA and vectorize row normalize
AlexBodner 8297820
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] fa0d248
Add MOT17 BoT-SORT ± ReID benchmark notebook for reid package integra…
AlexBodner c8e18a4
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] ea2c16f
Fix CI for private roboflow-reid git dependency.
AlexBodner 7e5e1af
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] de2d419
Keep roboflow-reid out of default dev sync in CI.
AlexBodner c76b864
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] c32edbc
docs: rewrite reid API page to match trackers style
AlexBodner 86e57e1
docs: add ReID comparison table and tighten BoT-SORT ReID section
AlexBodner 2980574
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 47001a1
Fix MOT17 ReID notebook side-by-side video render.
AlexBodner eaa023c
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 4a22cdf
ci: restore default install commands now that reid is optional-only
AlexBodner d69143e
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 8683b99
ci: install trackers[reid] in test and integration workflows
AlexBodner 1351cd9
refactor(reid): drop _reid seam and merge BoT-SORT ReID tests
AlexBodner c6696a1
fix(botsort): exclude reid_model from CLI param reflection only
AlexBodner a17749a
docs(reid): cite BoT-SORT for FeatureBank L2/EMA policy
AlexBodner 2f860c8
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 1d5b0b1
docs(reid): trim FeatureBank attribution prose
AlexBodner 8d4e63b
test(reid): clarify BoT-SORT fusion and embedding extraction tests
AlexBodner 116bd80
refactor(botsort): make proximity IoU optional in ReID fusion
AlexBodner f55a063
perf(botsort): reuse raw IoU for proximity when using standard IoU
AlexBodner ed74d88
refactor(botsort): drop always-on proximity IoU instance
AlexBodner 14a6d09
refactor(botsort): consolidate ReID association path in tracker
AlexBodner 9b9116b
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 36e4248
refactor(cli): single path for ReID validation and model load
AlexBodner 2f46154
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 0ee51cb
fix(reid): pin standalone reid package and harden optional-extra CI
AlexBodner a2556cb
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] a7ebc45
refactor(reid): slim FeatureBank and ReID CLI wiring
AlexBodner 68ee592
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] eba0916
docs(reid): cite BoT-SORT update_features on FeatureBank
AlexBodner 275e56a
Update reid.md
AlexBodner 6d47682
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 413f0ee
Update install.md
AlexBodner 02b16b3
docs(reid): add MOT17 with/without ReID test and val scores
AlexBodner e7ada23
docs(reid): link Use with BoT-SORT to the reid training guide
AlexBodner ba32be8
docs(reid): add threshold guide with MOT17 and SoccerNet distance plots
AlexBodner 50ee04a
Update reid.md
AlexBodner 3fa5c46
docs(reid): add SoccerNet OSNet θ=0.1 vs θ=0.2 scores
AlexBodner 859dd04
docs(reid): plot appearance distances as counts, not density
AlexBodner a4a68fe
docs(reid): restore probability-density appearance distance plots
AlexBodner b499f62
docs(reid): mark only the appearance thresholds used in the tables
AlexBodner 6691325
docs(reid): use neutral colors for appearance threshold lines
AlexBodner 7674438
docs(reid): plot appearance distances as fraction of samples per bin
AlexBodner dacd545
docs: resolve mkdocstrings from src/ for local API docs
AlexBodner b9108d8
docs(reid): split ReID guide out of the API reference page
AlexBodner 1cfb91e
docs(reid): correct extra contents and align ReID pages with siblings
AlexBodner e6b3e38
docs(reid): describe appearance fusion as cost lowering, not rejection
AlexBodner fd17f03
docs(botsort): fix appearance_threshold docstring framing
AlexBodner bddbcb3
Add paper-style d_app fraction histogram to MOT17 ReID eval notebook.
AlexBodner d3d9821
Fix Colab install for private reid in eval_trackers_reid.
AlexBodner 71b8cdb
Apply suggestions from code review
Borda 74b29ca
deps(reid): pin trackers[reid] to PyPI 0.1.0.dev0
AlexBodner ed40597
notebooks: install reid from PyPI in MOT17 ReID eval Colab setup
AlexBodner ecfd066
docs(reid): refresh association-local appearance distance plots
AlexBodner e201135
chore(reid): retitle association package docstring
AlexBodner 4983195
merge(develop): resolve conflicts for reid + McByte extras
AlexBodner ce1571c
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 491b988
fix(reid): clear pre-commit findings in ReID notebooks
AlexBodner b4392ce
fix(reid): clear pre-commit findings after develop merge
AlexBodner db59706
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 1adbc0e
fix(notebook): stabilize pretty-format-json for ReID eval notebook
AlexBodner 518cd4b
Potential fix for pull request finding
AlexBodner e986ace
docs(reid): note frame= requirement for appearance association
AlexBodner 1749b62
notebooks(reid): install trackers[reid] from PyPI in Colab setup
AlexBodner 1b7c3bb
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 170e171
notebooks(reid): reshape How to Add ReID to Trackers tutorial
AlexBodner 7467abe
fix(reid): sample appearance-distance pairs without sequence bias
AlexBodner d804121
docs(reid): explain what the ROC AUC panel measures
AlexBodner b84fff0
docs(reid): drop the tutorial notebook, it belongs in roboflow/notebooks
AlexBodner cc9fb24
docs(reid): simplify the frame-gap sweep figure
AlexBodner 7e1d30a
docs(reid): say that separability is not the shaded overlap
AlexBodner 66b12ec
docs(reid): say why separability is measured as ROC AUC
AlexBodner c708dfc
fix(reid): drop the repo-wide codespell exception for one docstring
AlexBodner 46e2330
Merge remote-tracking branch 'origin/develop' into feat/core/reid-con…
AlexBodner e7422ee
refactor(reid): port the ReID CLI onto the jsonargparse track command
AlexBodner 43b734e
Merge remote-tracking branch 'origin/develop' into feat/core/reid-con…
AlexBodner e5cd3e6
style(readme): apply mdformat wrapping to the merged feature list
AlexBodner 1dc0127
test(reid): split the tracker-agnostic ReID tests out of the BoT-SORT…
AlexBodner 29484bb
feat(reid): ship the appearance threshold-selection plots as library …
AlexBodner 8153c87
docs(reid): add the ReID cookbook, rebuilt on the library helpers
AlexBodner 2b85164
Merge branch 'develop' into feat/core/reid-consume-reid-package
Borda f2a0d4b
correctness: hoist frame validation, fix ZeroDivisionError, narrow ex…
Borda 1230c3e
test-coverage: cover _load_reid_model raises, --source guard, unconfi…
Borda ed24227
perf: batch L2-normalize in ReID appearance path
Borda c4747c0
docs: fix unrunnable examples, cookbook offset, and ReID docstrings
Borda e10f75a
deps-decision: add scheduled CI job to catch breaking reid pre-releases
Borda abf56da
data-integrity: preserve non-int labels, fix pair-sampling bias, wide…
Borda c2669c3
feat(reid): extract MOT GT crop embeddings
AlexBodner 4021677
api-design: root-export ReID API, rename threshold params, add ADR, w…
Borda f875466
Merge remote-tracking branch 'origin/feat/core/reid-consume-reid-pack…
AlexBodner be5b65d
fix(reid): correct extract_detection_embeddings doctest expected output
Borda 4f20658
Merge branch 'feat/core/reid-consume-reid-package' of https://github.…
Borda a507ec5
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] ec806b2
refactor(reid): move appearance fusion to core/reid
AlexBodner ab852da
refactor(reid): simplify appearance threshold sampling and metric
AlexBodner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| --- | ||
| description: Python API reference for the ReID encoder protocol, feature bank, and appearance association utilities in Roboflow Trackers. | ||
| --- | ||
|
|
||
| # ReID API | ||
|
|
||
| Requires the `reid` extra (`pip install "trackers[reid]"`, see the | ||
| [install guide](../learn/install.md)). | ||
|
|
||
| This page covers the `ReIDEncoder` protocol, `FeatureBank`, and appearance | ||
| association helpers in `trackers.core.reid`. For enabling appearance on | ||
| BoT-SORT, threshold selection, and benchmark results, see the | ||
| [ReID appearance guide](../learn/reid.md). Model loading and gallery evaluation | ||
| are in the standalone [`reid`](https://github.com/roboflow/re-ID) package. | ||
|
Borda marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## ReIDEncoder | ||
|
|
||
| ::: trackers.core.reid.encoder.ReIDEncoder | ||
|
|
||
| ## FeatureBank | ||
|
|
||
| ::: trackers.core.reid.feature_bank.FeatureBank | ||
|
|
||
| ## appearance_similarity | ||
|
|
||
| ::: trackers.core.reid.appearance.appearance_similarity | ||
|
|
||
| ## extract_detection_embeddings | ||
|
|
||
| ::: trackers.core.reid.appearance.extract_detection_embeddings | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| --- | ||
| title: ReID Appearance — BoT-SORT Appearance Association | Trackers | ||
| description: Use ReID appearance association with BoT-SORT in Roboflow Trackers, from model loading to appearance threshold selection, with MOT17 and SoccerNet results. | ||
| --- | ||
|
|
||
| # ReID Appearance | ||
|
|
||
| BoT-SORT can fuse appearance embeddings with IoU during association. Embeddings | ||
| come from a model in the standalone [`reid`](https://github.com/roboflow/re-ID) | ||
| package. See the [ReID API](../api/reid.md) for the association helpers. | ||
|
|
||
| **What you'll learn:** | ||
|
|
||
| - How to enable appearance association on BoT-SORT | ||
| - Which parameters control the appearance gate | ||
| - How to pick `appearance_threshold` for your encoder and domain | ||
| - What ReID changes on MOT17 and SoccerNet | ||
|
|
||
| --- | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| pip install "trackers[reid]" | ||
| ``` | ||
|
|
||
| For extra contents and other options, see the [install guide](install.md). | ||
|
|
||
| --- | ||
|
|
||
| ## Quickstart | ||
|
|
||
| ```python | ||
| from reid import ReIDModel | ||
|
|
||
| from trackers import BoTSORTTracker | ||
|
|
||
| reid_model = ReIDModel.from_pretrained("fastreid_mot17_sbs50") | ||
| tracker = BoTSORTTracker(reid_model=reid_model, appearance_threshold=0.2) | ||
| ``` | ||
|
|
||
|
Borda marked this conversation as resolved.
|
||
| For the model catalog and fine-tuning, see the | ||
| [`reid` training guide](https://github.com/roboflow/re-ID/blob/main/docs/learn/train.md). | ||
|
|
||
| --- | ||
|
|
||
| ## Key Parameters | ||
|
|
||
| | Parameter | Purpose | Tuning guidance | | ||
| | ---------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | | ||
| | `reid_model` | Appearance encoder queried during association. | Leave unset for IoU and CMC only. Pick a checkpoint trained on your object domain where possible. | | ||
| | `reid_ema_alpha` | EMA momentum for a track's appearance feature. | Default 0.9. Higher keeps a stable long-term identity; lower adapts faster to appearance change but drifts more. | | ||
| | `appearance_threshold` | Maximum appearance distance `d_app` for appearance to lower a pair's matching cost. | BoT-SORT paper default 0.25. Calibrate per encoder and domain, see below. | | ||
| | `proximity_threshold` | IoU gate applied before appearance (`IoU ≥ 1 - proximity_threshold`), from true IoU even with GIoU/DIoU/CIoU. | Default 0.5. Lower restricts how far apart a pair may be before appearance stops contributing. | | ||
|
|
||
| --- | ||
|
|
||
| ## Choosing an appearance threshold | ||
|
|
||
| BoT-SORT fuses costs as `min(d_iou, d_app)` with | ||
| `d_app = 0.5 * (1 - cos_sim)`, and discards the appearance term when `d_app` | ||
| exceeds `appearance_threshold` (paper default 0.25) or when the pair fails the | ||
| `proximity_threshold` IoU gate. Appearance can therefore only lower a pair's | ||
| cost, never veto a geometric match. Pick θ on a labeled split with the encoder | ||
| you will track with: | ||
|
|
||
| 1. Embed GT crops. | ||
| 2. Histogram `d_app` for same-ID vs different-ID pairs. | ||
| 3. Choose θ so most same-ID pairs fall below it and most different-ID pairs fall | ||
| above it. | ||
|
|
||
| **MOT17 val, `fastreid_mot17_sbs50`.** Same-ID distances peak near 0 and | ||
| different-ID near 0.4. On 1360 same-ID and 2800 different-ID GT crop pairs, θ=0.2 | ||
| keeps 88% of same-ID pairs while passing 1% of different-ID pairs, which is why | ||
| it beats the paper default 0.25 here | ||
| ([MOT17 re-ID study](https://www-sop.inria.fr/members/Francois.Bremond/Postscript/Tomasz__SCCAI_2025.pdf) | ||
| Table 8 uses the same threshold). | ||
|
|
||
|  | ||
|
|
||
| **SoccerNet test, `osnet_x1_0_msmt17_combineall`.** Same-ID and different-ID | ||
| distances overlap heavily (similar kits). On 1200 same-ID and 2400 different-ID | ||
| GT crop pairs, θ=0.2 admits 97% of same-ID pairs but also 50% of different-ID | ||
| pairs, and tracking stays flat against CMC-only. θ=0.1 holds different-ID pairs | ||
| to 9%, yet appearance still assists a mix of correct and same-kit pairs and | ||
| costs HOTA and IDF1 (see the SoccerNet table below). | ||
|
|
||
|  | ||
|
|
||
| --- | ||
|
|
||
| ## BoT-SORT with and without ReID | ||
|
|
||
| ### MOT17 test | ||
|
|
||
| YOLOX detections, CMC on, Codabench MOT17 test (same protocol as the | ||
| [tracker comparison](../trackers/comparison.md) default table). ReID: | ||
| `fastreid_mot17_sbs50`, `appearance_threshold=0.2` | ||
| ([MOT17 re-ID study](https://www-sop.inria.fr/members/Francois.Bremond/Postscript/Tomasz__SCCAI_2025.pdf) | ||
| Table 8). | ||
|
|
||
| | Config | HOTA | IDF1 | MOTA | | ||
| | :-------------- | :----: | :----: | :----: | | ||
| | BoT-SORT | 63.7 | 78.7 | **79.2** | | ||
| | BoT-SORT + ReID | **63.9** | **79.2** | **79.2** | | ||
|
|
||
| ### MOT17 val-half | ||
|
|
||
| YOLOX detections, CMC on, MOT17 val-half split, same encoder and threshold, | ||
| scored with `trackers eval`. | ||
|
|
||
| | Config | HOTA | IDF1 | MOTA | | ||
| | :-------------- | :----: | :----: | :----: | | ||
| | BoT-SORT | 68.9 | 81.2 | 78.3 | | ||
| | BoT-SORT + ReID | **69.1** | **81.9** | **78.4** | | ||
|
|
||
| The MOT17 re-ID study reports 68.43 HOTA / 80.92 IDF1 without ReID and | ||
| 68.95 / 81.98 with, on the same split at `appearance_threshold=0.2` | ||
| (Table 8 and Table 13; MOTA is not reported for that YOLOX setup). | ||
|
|
||
| ### SoccerNet test (OSNet MSMT17) | ||
|
|
||
| Oracle detections, CMC on, SoccerNet-tracking test (same protocol as the | ||
| [tracker comparison](../trackers/comparison.md) default table). ReID: | ||
| `osnet_x1_0_msmt17_combineall` (MSMT17 pretrained), so this is a cross-domain | ||
| encoder on soccer footage. | ||
|
|
||
| | Config | HOTA | IDF1 | MOTA | | ||
| | :---------------------------------- | :----: | :----: | :----: | | ||
| | BoT-SORT | 84.5 | 79.3 | **96.6** | | ||
| | BoT-SORT + OSNet MSMT17 (θ=0.2) | **84.6** | **79.4** | **96.6** | | ||
| | BoT-SORT + OSNet MSMT17 (θ=0.1) | 82.9 | 77.7 | 96.5 | | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.