Add trackers track command for video object tracking#231
Merged
SkalskiP merged 23 commits intofeature/tracker-auto-registrationfrom Feb 10, 2026
Merged
Add trackers track command for video object tracking#231SkalskiP merged 23 commits intofeature/tracker-auto-registrationfrom
trackers track command for video object tracking#231SkalskiP merged 23 commits intofeature/tracker-auto-registrationfrom
Conversation
Implement `trackers track` CLI command combining inference-models detection with SORT/ByteTrack tracking. Features: - RF-DETR Nano as default model via inference-models - Support for video files, webcams, RTSP streams, image directories - Pre-computed detections via --detections (MOT format) - Dynamic tracker params from auto-registration (--tracker.*) - Visualization: boxes, masks, labels, IDs, confidence, trajectories - MOT format output for evaluation pipeline Files: - trackers/scripts/track.py: Main implementation - test/scripts/test_track.py: 29 unit tests - pyproject.toml: Add cli and inference optional deps
…ure/track-command
- Namespace model CLI args consistently (--model.device, --model.api_key) - Add device auto-detection for inference-models (cuda/mps/cpu) - Support directory as --output (saves as output.mp4 inside) - Use sv.xywh_to_xyxy for MOT format conversion - Color annotations by tracker ID with custom color palette - Skip labels for unconfirmed tracks (tracker_id == -1) - Remove unused rich dependency Refactor for testability: - _generate_labels: explicit bool params instead of argparse.Namespace - _check_output_writable: single-path validation function - _mot_frame_to_detections: simplified MOTFrameData converter
…ure/track-command # Conflicts: # trackers/scripts/track.py
- Rename best_device to _best_device with lazy torch import - Extract _mot_frame_to_detections as standalone function - Fix VideoOutput mypy error by passing path explicitly - Remove utils API docs (now empty)
- Fix mypy errors in VideoOutput by adding type annotations for
_writer and _create_writer return type
- Rename test/test_io to test/io to avoid Python import conflict
- Remove duplicate tests from test_track.py (now in test/io/)
- Simplify TestFormatLabels using np.array directly in parametrize
with descriptive pytest.param ids
- Fix trailing whitespace and end-of-file issues (pre-commit)
- Make internal IO helpers private: VideoOutput, DisplayWindow,
MOTSequenceData, prepare_mot_sequence, validate_output_path,
resolve_video_output_path (all prefixed with underscore)
- Move public exports (MOTFrameData, MOTOutput, load_mot_file) from
trackers.io to main trackers/__init__.py
- Rename test/io to test/io_tests to avoid Python built-in conflict
- Remove redundant "Tests for ..." docstrings from all test files
- Remove examples from private functions
- Update API docs to reflect public-only exports
_VideoOutput: - Add configurable fps parameter (default 30.0) - Return bool from write() for error detection - Add isOpened() check with OSError on failure _DisplayWindow: - Add resizable window (WINDOW_NORMAL | WINDOW_KEEPRATIO) - Support ESC key (27) in addition to 'q' for quit - Return quit status from show() - Only destroy its own window, not all windows Also: - Remove verbose Examples from frames_from_source docstring - Remove empty utils docstring
- Rename MOTOutput to _MOTOutput
- Rename load_mot_file to _load_mot_file
- Rename MOTFrameData to _MOTFrameData
- Remove MOTOutput, load_mot_file, MOTFrameData from public exports
in trackers/__init__.py
- Update all internal usages to reference private symbols
- Remove entries from API docs (only frames_from_source remains public)
Documentation:
- Add comprehensive docs/learn/track.md guide with CLI and Python examples
covering Install, Quickstart, Trackers, Detectors, Visualization,
Source, Output, and Integration sections
- Add Track page to mkdocs navigation
- Simplify README.md and docs/index.md code examples
- Add CLI Quickstart section to README.md and docs/index.md
- Update benchmark table with BoT-SORT and McByte placeholders
- Use backticks for library names (trackers, opencv-python, etc.)
- Link to new Track guide from Integration sections
CLI improvements:
- Make --model optional, defaults to rfdetr-nano
- Make --show-ids default to True, add --no-ids to disable
- Fix webcam input by converting numeric string "0" to int
- Add reusable terminal-style CLI builder framework
(cli_builder_framework.js) with state management, event delegation,
numeric hold-to-repeat steppers, and MkDocs style syncing
- Refactor command_builder.js into a thin config layer on top of the
framework for the `trackers track` command
- Add command_builder.css with terminal-themed styling, grid alignment,
and responsive layout
- Add CLI Command Builder section to track.md with interactive widget
for model, tracker, visualization, source, and output configuration
- Restore demo video embed above Install section
- Wire framework and builder assets in mkdocs.yml
…ure/track-command
SkalskiP
added a commit
that referenced
this pull request
Feb 10, 2026
* Fix ruff and mypy linting errors * fix(pre_commit): 🎨 auto format pre-commit hooks * Clean up registration API: mark internal methods, improve docstrings Mark _lookup_tracker and _registered_trackers as internal for CLI use. Rewrite docstrings, remove BaseTrackerWithFeatures, consolidate tests. * fix(pre_commit): 🎨 auto format pre-commit hooks * Add `trackers track` command for video object tracking (#231) * Add track command for video object tracking Implement `trackers track` CLI command combining inference-models detection with SORT/ByteTrack tracking. Features: - RF-DETR Nano as default model via inference-models - Support for video files, webcams, RTSP streams, image directories - Pre-computed detections via --detections (MOT format) - Dynamic tracker params from auto-registration (--tracker.*) - Visualization: boxes, masks, labels, IDs, confidence, trajectories - MOT format output for evaluation pipeline Files: - trackers/scripts/track.py: Main implementation - test/scripts/test_track.py: 29 unit tests - pyproject.toml: Add cli and inference optional deps * fix(pre_commit): 🎨 auto format pre-commit hooks * Fixed. Ruff check passes now. * Improve track command UX and code testability - Namespace model CLI args consistently (--model.device, --model.api_key) - Add device auto-detection for inference-models (cuda/mps/cpu) - Support directory as --output (saves as output.mp4 inside) - Use sv.xywh_to_xyxy for MOT format conversion - Color annotations by tracker ID with custom color palette - Skip labels for unconfirmed tracks (tracker_id == -1) - Remove unused rich dependency Refactor for testability: - _generate_labels: explicit bool params instead of argparse.Namespace - _check_output_writable: single-path validation function - _mot_frame_to_detections: simplified MOTFrameData converter * fix(pre_commit): 🎨 auto format pre-commit hooks * update PR * fix(pre_commit): 🎨 auto format pre-commit hooks * Make device detection and MOT conversion helpers private - Rename best_device to _best_device with lazy torch import - Extract _mot_frame_to_detections as standalone function - Fix VideoOutput mypy error by passing path explicitly - Remove utils API docs (now empty) * Clean up tests and fix mypy type annotations - Fix mypy errors in VideoOutput by adding type annotations for _writer and _create_writer return type - Rename test/test_io to test/io to avoid Python import conflict - Remove duplicate tests from test_track.py (now in test/io/) - Simplify TestFormatLabels using np.array directly in parametrize with descriptive pytest.param ids - Fix trailing whitespace and end-of-file issues (pre-commit) * Refactor IO module: privatize internals and consolidate exports - Make internal IO helpers private: VideoOutput, DisplayWindow, MOTSequenceData, prepare_mot_sequence, validate_output_path, resolve_video_output_path (all prefixed with underscore) - Move public exports (MOTFrameData, MOTOutput, load_mot_file) from trackers.io to main trackers/__init__.py - Rename test/io to test/io_tests to avoid Python built-in conflict - Remove redundant "Tests for ..." docstrings from all test files - Remove examples from private functions - Update API docs to reflect public-only exports * Test * Improve video I/O classes and clean up docstrings _VideoOutput: - Add configurable fps parameter (default 30.0) - Return bool from write() for error detection - Add isOpened() check with OSError on failure _DisplayWindow: - Add resizable window (WINDOW_NORMAL | WINDOW_KEEPRATIO) - Support ESC key (27) in addition to 'q' for quit - Return quit status from show() - Only destroy its own window, not all windows Also: - Remove verbose Examples from frames_from_source docstring - Remove empty utils docstring * Make MOT I/O classes and functions private - Rename MOTOutput to _MOTOutput - Rename load_mot_file to _load_mot_file - Rename MOTFrameData to _MOTFrameData - Remove MOTOutput, load_mot_file, MOTFrameData from public exports in trackers/__init__.py - Update all internal usages to reference private symbols - Remove entries from API docs (only frames_from_source remains public) * Add Track documentation and improve CLI defaults Documentation: - Add comprehensive docs/learn/track.md guide with CLI and Python examples covering Install, Quickstart, Trackers, Detectors, Visualization, Source, Output, and Integration sections - Add Track page to mkdocs navigation - Simplify README.md and docs/index.md code examples - Add CLI Quickstart section to README.md and docs/index.md - Update benchmark table with BoT-SORT and McByte placeholders - Use backticks for library names (trackers, opencv-python, etc.) - Link to new Track guide from Integration sections CLI improvements: - Make --model optional, defaults to rfdetr-nano - Make --show-ids default to True, add --no-ids to disable - Fix webcam input by converting numeric string "0" to int * Improved CLI args formatting. * Add interactive CLI command builder widget to Track docs - Add reusable terminal-style CLI builder framework (cli_builder_framework.js) with state management, event delegation, numeric hold-to-repeat steppers, and MkDocs style syncing - Refactor command_builder.js into a thin config layer on top of the framework for the `trackers track` command - Add command_builder.css with terminal-themed styling, grid alignment, and responsive layout - Add CLI Command Builder section to track.md with interactive widget for model, tracker, visualization, source, and output configuration - Restore demo video embed above Install section - Wire framework and builder assets in mkdocs.yml * fix(pre_commit): 🎨 auto format pre-commit hooks * Remove Integration page. * fix(pre_commit): 🎨 auto format pre-commit hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds the
trackers trackCLI command that combines object detection with multi-object tracking for end-to-end video analysis.inference-modelsfor detection (RF-DETR Nano default, supports all RF-DETR variants + custom Roboflow models)--tracker.*flags