Skip to content

Feat/core/CBioU tracker#417

Open
AlexBodner wants to merge 28 commits into
developfrom
feat/core/cbiou-tracker
Open

Feat/core/CBioU tracker#417
AlexBodner wants to merge 28 commits into
developfrom
feat/core/cbiou-tracker

Conversation

@AlexBodner
Copy link
Copy Markdown
Collaborator

What does this PR do?

Adding CBIoU tracker as wrapper of IoU variants BIoU and BoTsort without cmc (which would be original bytetrack).

Still missing the metrics

Type of Change

  • New feature (non-breaking change that adds functionality)

Testing

  • I have tested this change locally
  • I have added/updated tests for this change

Test details:

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have updated the documentation accordingly (if applicable)

Additional Context

AlexBodner and others added 2 commits May 14, 2026 13:48
- New `CBIoUTracker` subclass of `BoTSORTTracker` registered as "cbiou"
- CMC permanently disabled; `buffer_ratio` elevated as first-class param
- `update()` emits UserWarning when frame is passed (CMC off)
- `search_space` covers all tunable params + buffer_ratio [0.0, 0.5]
- 13 dedicated tests in tests/core/test_cbiou_tracker.py
- `IOC_TRACKER_IDS` in shared_ids.py excludes CBIoU from iou= injection test
- Exported from top-level trackers package

Co-authored-by: Cursor <cursoragent@cursor.com>
@AlexBodner AlexBodner requested a review from SkalskiP as a code owner May 14, 2026 19:06
pre-commit-ci Bot and others added 2 commits May 14, 2026 19:06
Plans are working documents and should not be tracked in the repository.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new CBIoU tracker as a BoT-SORT-derived tracker that disables CMC and uses Buffered IoU for association, then exposes it through the package API and shared tracker test coverage.

Changes:

  • Adds CBIoUTracker implementation and package entry point.
  • Exports CBIoU from trackers.
  • Extends tracker registration/shared behavior tests and adds CBIoU-specific tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/trackers/core/cbiou/tracker.py Implements the CBIoU tracker wrapper around BoT-SORT with BIoU and CMC disabled.
src/trackers/core/cbiou/__init__.py Adds the new CBIoU package.
src/trackers/__init__.py Exposes CBIoUTracker from the top-level package.
tests/core/shared_ids.py Adds cbiou to shared tracker IDs and separates IoU-configurable trackers.
tests/core/test_trackers.py Excludes CBIoU from the configurable-IoU test.
tests/core/test_registration.py Includes CBIoU in registration/search-space coverage.
tests/core/test_cbiou_tracker.py Adds CBIoU-specific construction, warning, association, and search-space tests.

Comment thread tests/core/test_cbiou_tracker.py Outdated
Comment thread tests/core/shared_ids.py Outdated
Comment thread tests/core/test_cbiou_tracker.py Outdated
Comment thread src/trackers/core/cbiou/__init__.py
Comment thread tests/core/test_cbiou_tracker.py Outdated
Comment thread src/trackers/__init__.py
@AlexBodner AlexBodner changed the title Feat/core/cbiou tracker Feat/core/CBioU tracker May 15, 2026
@Borda
Copy link
Copy Markdown
Member

Borda commented May 18, 2026

Let's mark as resolved the comment which you already addressed, so we know what is left

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (2)

docs/trackers/comparison.md:187

  • The comparison page lists enable_cmc: false under the C-BIoU configuration, but CBIoUTracker.init does not accept an enable_cmc parameter (CMC is always disabled internally). Remove this key from the example config (or reword it as a note) to avoid suggesting an invalid constructor argument.
      high_conf_det_threshold: 0.6
      track_activation_threshold: 0.7
      buffer_ratio_first: 0.3
      buffer_ratio_second: 0.5
      enable_cmc: false

docs/trackers/comparison.md:367

  • The comparison page lists enable_cmc: false under the C-BIoU configuration, but CBIoUTracker.init does not accept an enable_cmc parameter (CMC is always disabled internally). Remove this key from the example config (or reword it as a note) to avoid suggesting an invalid constructor argument.
      high_conf_det_threshold: 0.36
      track_activation_threshold: 0.83
      buffer_ratio_first: 0.23
      buffer_ratio_second: 0.33
      enable_cmc: false

Comment thread src/trackers/core/cbiou/tracker.py
Comment thread src/trackers/core/cbiou/tracker.py
Comment thread tests/core/test_cbiou_tracker.py Outdated
Comment thread docs/trackers/comparison.md
Comment thread docs/trackers/comparison.md
@AlexBodner AlexBodner requested a review from Borda May 19, 2026 18:43
@Borda Borda requested a review from tstanczyk95 May 20, 2026 09:44
@Borda Borda added the enhancement New feature or request label May 20, 2026
Comment thread docs/trackers/cbiou.md Outdated
Borda
Borda previously approved these changes May 20, 2026
Comment thread docs/trackers/cbiou.md
---
title: C-BIoU — Cascaded-Buffered IoU Tracker | Trackers
comments: true
description: C-BIoU improves association under fast motion and similar appearances by matching with Buffered IoU instead of plain IoU, using a BoT-SORT-style pipeline without camera motion compensation.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Similar appearances" doesn't sound right here as C-BIoU doesn't use any re-ID or visual appearance matching.

"BoT-SORT-style pipeline without camera motion compensation" sounds confusing, as the main contribution of the implemented BoT-SORT is exactly camera motion compensation.
I would rather say ByteTrack-style pipeline. I know that state estimator and such are rather the ones as in BoT-SORT, but in the docs the description as provided might be confusing, so we might want to clarify it.

Comment thread docs/trackers/cbiou.md

## What is C-BIoU?

C-BIoU builds on the same tracking pipeline as [ByteTrack](bytetrack.md) and [BoT-SORT](botsort.md) but replaces plain IoU with **Buffered IoU (BIoU)**, expanding boxes before overlap is computed so tracks and detections can still match when motion is fast or boxes barely align. It runs two association passes with a small buffer first and a larger buffer second (`buffer_ratio_first` and `buffer_ratio_second`), and does not use camera motion compensation, so only bounding boxes are required. C-BIoU is a strong fit for sports and dance footage where objects move irregularly and look alike.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"when motion is fast" -> "when motion of the object" or "movement of the objects"

(optionally "entities" instead of "objects")

Further, "where objects [...] and look alike": the same remarks as for "similar appearances" above https://github.com/roboflow/trackers/pull/417/changes#r3273963540

Comment thread docs/trackers/cbiou.md

## How does C-BIoU work?

C-BIoU keeps the [ByteTrack](bytetrack.md)-style association pipeline used in [BoT-SORT](botsort.md) but replaces plain IoU with **cascaded Buffered IoU** at each association step.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upper case: either "Cascaded Buffered IoU" or "cascaded buffered IoU", not mixing.

Comment thread docs/trackers/cbiou.md

C-BIoU keeps the [ByteTrack](bytetrack.md)-style association pipeline used in [BoT-SORT](botsort.md) but replaces plain IoU with **cascaded Buffered IoU** at each association step.

**First association (b1).** High-confidence detections are matched to confirmed and lost tracks using BIoU with `buffer_ratio_first` (paper **b1**, small buffer). Costs are fused with detection confidence.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you say "paper b1" here, you might provide the link to the reference section below: ## Reference
Same for "paper b2" below.

Comment thread docs/trackers/cbiou.md

**First association (b1).** High-confidence detections are matched to confirmed and lost tracks using BIoU with `buffer_ratio_first` (paper **b1**, small buffer). Costs are fused with detection confidence.

**Second association (b2).** Remaining *tracked* tracks (not lost) are matched to low-confidence detections using BIoU with `buffer_ratio_second` (paper **b2**, large buffer). Score fusion is not applied here. In the paper, the large buffer is applied to **remaining unmatched track/detection pairs** after the first cascade; here it is wired to ByteTrack's low-confidence recovery stage.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Score fusion is not applied here" -> It hasn't been mentioned before. Thus either mention it before or remove it from here. I would opt for removing it.

I would change the last sentence into:
"In the paper, the large buffer is applied to remaining unmatched track/unmatched detection pairs after the first cascade; here it is wired to ByteTrack's unmatched track/low-confidence detection recovery stage."

out_tracker_ids.append(-1)

# Step 3: match unconfirmed tracks with remaining unmatched high-confidence
# detections (ByteTrack lifecycle; reuses b1 / iou_first, not a paper parameter).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say remove "not a paper parameter" for clarity.

It has been mentioned in the docs within the larger context. Here it might cause extra confusion.

self.iou_first = BIoU(buffer_ratio=buffer_ratio_first)
self.iou_second = BIoU(buffer_ratio=buffer_ratio_second)
self.buffer_ratio_first = buffer_ratio_first
self.buffer_ratio_second = buffer_ratio_second
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider some warning for the user if ultimately self.buffer_ratio_first becomes higher or equal to self.buffer_ratio_second?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think so, it is just recommended by paper authors, but like you pointed over Slack, if it works better or the user sees fit using a higher threshold first should be fine

class TestCBIoUAssociationTolerance:
"""BIoU should associate near-miss detections that plain IoU would miss."""

def test_near_miss_associated_with_buffer(self) -> None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test to demonstrate, but it actually safe? And not too number/case-specific?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is very specific, but it tests what we want right? what seems off to you?



@pytest.mark.parametrize("tracker_id", ALL_TRACKER_IDS)
@pytest.mark.parametrize("tracker_id", IOU_TRACKER_IDS)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we do this distinction here? I mean why excluding C-BIoU here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because its testing that the IoU variants are properly used as the user passed as parameter. This is not an option in CBIoU as its forced to be BIoU

assert tracking_iou.compute_calls > 0


@pytest.mark.parametrize("tracker_id", ALL_TRACKER_IDS)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might have missed, but where are all these tests now? This is quite a big block of tests being removed. I saw a big addition above https://github.com/roboflow/trackers/pull/417/changes#diff-e03730a206379add4fc7c6e8b37ae01ffc5564cc8ccfdfb3f2917255cef0aee3R1 but it was C-BIoU-specific.

Thus what happens with such tests for the other trackers then?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is conflicting because we adjusted these tests at https://github.com/roboflow/trackers/pull/415/changes#diff-c4ed0ac20c4d9ad9eb94afd554b45099460a4f85b5edfac4c3eba1f85d04a6cb
Thanks for pointing this out, Im going to merge with these changes that we wanted

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handled this in fc66939

Borda and others added 2 commits May 20, 2026 18:52
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants