Conversation
`supervision-0.26.1` release
Fix Albumentations docs typo
supervision-0.27.0 release
…o refactor/typing-tracker
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2131 +/- ##
=======================================
Coverage 72% 72%
=======================================
Files 61 61
Lines 7245 7250 +5
=======================================
+ Hits 5242 5247 +5
Misses 2003 2003 🚀 New features to boost your workflow:
|
|
The link checker failed with a 503 error on docs/changelog.md, which I didn't modify. Since I don't have permission to re run the job, could a maintainer please trigger it for me? |
There was a problem hiding this comment.
Pull request overview
This PR refactors the byte_tracker module to improve type safety by adding comprehensive type hints using numpy.typing and standardizing all docstrings to follow the project's Google-style documentation format. Additionally, a typo in the documentation was fixed (correcting "augmentation" to "albumentations").
Changes:
- Added proper numpy type hints (
npt.NDArray[np.float32]) throughout the byte_tracker module - Converted all docstrings from mixed styles to Google-style format
- Fixed return type annotation for
sub_tracksfunction (waslist[int], now correctlylist[STrack]) - Fixed typo in documentation: "augmentation" → "albumentations"
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/supervision/tracker/byte_tracker/utils.py | Added Google-style docstrings for IdCounter class methods with proper type hints |
| src/supervision/tracker/byte_tracker/single_object_track.py | Updated update() method docstring to Google-style and added type hints to static methods (tlwh_to_xyah, tlbr_to_tlwh, tlwh_to_tlbr) |
| src/supervision/tracker/byte_tracker/matching.py | Added numpy.typing import and comprehensive type hints for all function signatures including npt.NDArray[np.float32] |
| src/supervision/tracker/byte_tracker/kalman_filter.py | Reformatted all docstrings to Google-style, added type hints with npt.NDArray[np.float32] for all methods, and improved documentation clarity |
| src/supervision/tracker/byte_tracker/core.py | Standardized parameter documentation style (removing type annotations in docstrings), fixed return type for sub_tracks function from incorrect list[int] to correct list[STrack] |
| docs/how_to/process_datasets.md | Fixed typo in pip install command: "augmentation" → "albumentations" |
| start_id: The starting integer for the counter. | ||
|
|
||
| Raises: | ||
| ValueError: If start_id is less than or equal to NO_ID. |
There was a problem hiding this comment.
The docstring references "NO_ID" but this is actually a property (self.NO_ID), not a constant. The error message should be clearer about what NO_ID is, or the documentation should specify it's a property that returns -1. Consider updating to: "ValueError: If start_id is less than or equal to -1."
| ValueError: If start_id is less than or equal to NO_ID. | |
| ValueError: If start_id is less than or equal to -1. |
|
|
||
| def iou_distance(atracks: list[STrack], btracks: list[STrack]) -> np.ndarray: | ||
| def iou_distance( | ||
| atracks: list[STrack] | list[npt.NDArray], btracks: list[STrack] | list[npt.NDArray] |
There was a problem hiding this comment.
The type hint "list[npt.NDArray]" is ambiguous and should specify the numpy array dtype for consistency with the rest of the codebase. Consider using "list[STrack] | list[npt.NDArray[np.float32]]" to be more specific about the array type expected.
| atracks: list[STrack] | list[npt.NDArray], btracks: list[STrack] | list[npt.NDArray] | |
| atracks: list[STrack] | list[npt.NDArray[np.float32]], | |
| btracks: list[STrack] | list[npt.NDArray[np.float32]], |
Before submitting
Description
Refactored the byte_tracker module to improve type safety and standardize docstrings.
Type of Change
Motivation and Context
The code was using mixed documentation styles. I updated it to match the project standard and added missing type hints for better IDE support.
Changes Made
Testing