supervision/tests/utils
abritton2002 51dd062407
fix: VideoInfo.fps returns float instead of truncated int (#2210)
* VideoInfo.fps returns float instead of int

Truncating the raw CAP_PROP_FPS value with int() causes timing drift for
non-integer frame rates (23.976, 29.97, 59.94). Over a long video this
accumulates into noticeable sync errors — e.g. 23 vs 23.976 drifts ~1s
per minute of footage.

Changes:
- VideoInfo.fps type annotation: int -> float
- from_video_path: int(video.get(CAP_PROP_FPS)) -> float(...)
- ByteTrack.frame_rate type annotation: int -> float (already converts
  to int internally via max_time_lost = int(frame_rate / 30.0 * buffer))
- Tests: assert fps is float, add float_fps_video_path fixture at 23.976

* fix: update examples to cast float fps to int where required
* fix: wrap long docstring line in FPSBasedTimer (ruff E501)
* test: remove unused float_fps_video_path fixture

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-13 20:05:19 +02:00
..
assets refactor: reorganize project structure and update module imports (#2112) 2026-02-03 15:24:47 +01:00
__init__.py refactor: reorganize project structure and update module imports (#2112) 2026-02-03 15:24:47 +01:00
conftest.py refactor: reorganize project structure and update module imports (#2112) 2026-02-03 15:24:47 +01:00
test_conversion.py refactor: reorganize project structure and update module imports (#2112) 2026-02-03 15:24:47 +01:00
test_file.py Add `match` arguments to all `pytest.raises` for more precise error validation in tests (#2145) 2026-02-10 21:22:55 +09:00
test_image.py refactor: reorganize project structure and update module imports (#2112) 2026-02-03 15:24:47 +01:00
test_internal.py Fix mask_annotate for int dtypes (#1445) 2026-02-20 10:43:56 +01:00
test_iterables.py refactor: reorganize project structure and update module imports (#2112) 2026-02-03 15:24:47 +01:00
test_logger.py feat: replace print statements with structured logging (#2154) 2026-02-20 13:14:53 +01:00
test_video.py fix: VideoInfo.fps returns float instead of truncated int (#2210) 2026-04-13 20:05:19 +02:00