Skip to content

Conversation

@lauriebax
Copy link

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Be able to use ByteTracker with a pretrained detector.

Modification

  • Make inference_mot more robust against configuration differences
  • Don't cast images to float before running test_pipeline, mimicking detection pipelines
  • Improve speed PackTrackInput
  • Update ByteTracker to also return instance masks

BC-breaking (Optional)

Output of inference_mot might be different because we don't cast to float before resizing causing different interpolation to happen
Output of inference_mot might be different because more transforms than just Resize are now used.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMPreTrain.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

fix: make build_test_pipeline for mot more robust against other transforms
update bytetracker unittest to pytest
@lauriebax lauriebax requested a review from Copilot December 11, 2025 13:42
Copy link

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

This PR enhances ByteTracker to support instance masks and improves the robustness and performance of multi-object tracking (MOT) inference pipelines.

Key Changes:

  • Extended ByteTracker to handle and return instance masks alongside bounding boxes
  • Optimized PackTrackInput transformation with smarter memory layout handling (3-5x speedup)
  • Made inference_mot more flexible by preserving more transforms from the test pipeline instead of only keeping Resize

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
mmdet/models/trackers/byte_tracker.py Added mask tracking capabilities throughout the tracking pipeline
mmdet/datasets/transforms/formatting.py Optimized array operations by checking memory contiguity before transpose
mmdet/apis/inference.py Removed float casting and improved transform filtering logic
tests/test_models/test_trackers/test_byte_tracker.py Converted tests to pytest fixtures and added parameterized tests for mask support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lauriebax lauriebax self-assigned this Dec 11, 2025
if transform['type'] == 'Resize':
transform_broadcaster['transforms'] = transform
filtered_transforms = []
filtered_transforms = [

Choose a reason for hiding this comment

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

this is a very complicated list comprehension. I looked at it for couple of minutes and I still not completely understand what it does. Especially the bit with any(x in transform['type']. Could you simplify it?

Copy link
Author

Choose a reason for hiding this comment

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

Not really, since a transform can also sometimes have a scope in front (mmdet.LoadImage vs. LoadImage).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm okay with this comprehension

if transform['type'] == 'Resize':
transform_broadcaster['transforms'] = transform
filtered_transforms = []
filtered_transforms = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm okay with this comprehension

@github-actions
Copy link

Package Line Rate Branch Rate Complexity Health
mmdet 100% 100% 0
mmdet.apis 69% 49% 0
mmdet.datasets 58% 39% 0
mmdet.datasets.api_wrappers 33% 28% 0
mmdet.datasets.samplers 54% 41% 0
mmdet.datasets.transforms 74% 53% 0
mmdet.engine 100% 100% 0
mmdet.engine.hooks 63% 43% 0
mmdet.engine.optimizers 98% 88% 0
mmdet.engine.runner 96% 83% 0
mmdet.engine.schedulers 100% 83% 0
mmdet.evaluation 100% 100% 0
mmdet.evaluation.evaluator 29% 0% 0
mmdet.evaluation.functional 68% 50% 0
mmdet.evaluation.metrics 57% 41% 0
mmdet.models 100% 100% 0
mmdet.models.backbones 80% 60% 0
mmdet.models.data_preprocessors 84% 69% 0
mmdet.models.dense_heads 82% 64% 0
mmdet.models.dense_heads.clr_head 48% 43% 0
mmdet.models.dense_heads.clr_head.losses 81% 50% 0
mmdet.models.dense_heads.clr_head.utils 55% 50% 0
mmdet.models.detectors 65% 40% 0
mmdet.models.language_models 64% 33% 0
mmdet.models.layers 87% 71% 0
mmdet.models.layers.transformer 85% 60% 0
mmdet.models.losses 85% 69% 0
mmdet.models.mot 91% 59% 0
mmdet.models.necks 67% 41% 0
mmdet.models.reid 89% 62% 0
mmdet.models.roi_heads 42% 22% 0
mmdet.models.roi_heads.bbox_heads 66% 46% 0
mmdet.models.roi_heads.mask_heads 86% 70% 0
mmdet.models.roi_heads.roi_extractors 97% 91% 0
mmdet.models.roi_heads.shared_heads 72% 33% 0
mmdet.models.seg_heads 98% 92% 0
mmdet.models.seg_heads.panoptic_fusion_heads 88% 55% 0
mmdet.models.task_modules 73% 100% 0
mmdet.models.task_modules.assigners 87% 66% 0
mmdet.models.task_modules.coders 76% 51% 0
mmdet.models.task_modules.prior_generators 79% 69% 0
mmdet.models.task_modules.samplers 62% 30% 0
mmdet.models.task_modules.tracking 90% 67% 0
mmdet.models.test_time_augs 46% 21% 0
mmdet.models.trackers 80% 58% 0
mmdet.models.tracking_heads 97% 74% 0
mmdet.models.utils 51% 36% 0
mmdet.models.vis 94% 57% 0
mmdet.structures 71% 34% 0
mmdet.structures.bbox 89% 79% 0
mmdet.structures.mask 69% 43% 0
mmdet.testing 84% 68% 0
mmdet.utils 40% 27% 0
mmdet.visualization 79% 67% 0
Summary 73% (33630 / 46296) 52% (6134 / 11800) 0

@illyakaynov-vbti illyakaynov-vbti merged commit b34e39a into main Dec 17, 2025
8 checks passed
@illyakaynov-vbti illyakaynov-vbti deleted the feat/improve-mot-and-bytetracker branch December 17, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants