Commit Graph

4706 Commits

Author SHA1 Message Date
Jirka Borovec 11f483b75e
examples/time_in_zone: improve CLI argument handling (#2057)
* refactor(time_in_zone): improve CLI argument handling
* Refactor examples with `jsonargparse` for improved CLI, rename `confidence` and `iou` arguments for consistency, and update documentation and requirements.
* fix(pre_commit): 🎨 auto format pre-commit hook

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-03 12:49:55 +01:00
Jirka Borovec 1688e71ed9
examples/speed_estimation: improve CLI argument parsing (#2056)
* refactor(speed_estimation): improve CLI argument parsing
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-03 12:02:22 +01:00
Jirka Borovec 45aedbda7e
examples/heatmap_and_track: improve CLI argument parsing (#2055)
* refactor(heatmap_and_track): improve CLI argument parsing
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Make `source_video_path` optional with default fallback to `download_video`; update defaults for `target_video_path`.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-03 11:52:25 +01:00
Jirka Borovec 6a1b2b8eb4
examples/count_people_in_zone: resolve IoU threshold & improve CLI (#2054)
* refactor(count_people_in_zone): resolve IoU threshold & improve CLI
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-03 11:35:09 +01:00
jirka 0dc9188c5b Add `link-check` input to CI workflows with conditional execution adjustments 2026-02-03 10:35:02 +01:00
Jirka Borovec a4de1a0f47
Refine CI with link checks for forked PRs (#2127)
* exclude RF universe links
2026-02-03 10:12:21 +01:00
Jirka Borovec 195f4618a3
Resolve link checker to smoothly work with forked PRs (#2125)
* Resolve link checker to smoothly work with forked PRs
* Add Snyk quality badge URL to excluded links in lychee config
* Simplify Lychee action configuration by removing redundant `env` key usage
* Update augment_links script to include branch/ref as argument in build workflow
2026-02-03 09:49:09 +01:00
Jirka Borovec fd2d63c1d7
move CODE_OF_CONDUCT.md and CONTRIBUTING.md for improved accessibility (#2036)
* Fix relative links in contribution-related docs and README

---------

Co-authored-by: jiri BOROVEC <jirka@Jiris-MacBook-Pro-J4N257Y6Q2.local>
2026-02-03 03:58:28 +01:00
pre-commit-ci[bot] c1887da1e8
chore: ⬆ pre_commit autoupdate & resolve many `numpy` typing (#2126)
* chore(pre_commit): ⬆ pre_commit autoupdate

updates:
- [github.com/tox-dev/pyproject-fmt: v2.11.1 → v2.12.1](https://github.com/tox-dev/pyproject-fmt/compare/v2.11.1...v2.12.1)
- [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.19.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.13.0...v1.19.1)

* fix(pre_commit): 🎨 auto format pre-commit hooks

* Convert type annotations across several `supervision/metrics` modules to `numpy.typing` for improved alignment with `numpy` standards.
* Add `# type: ignore[no-untyped-call]` annotations in `mean_average_precision.py` for linting compliance
* Refactor `detection.py` to use `getattr` for `np.trapz` and update dependencies in `.pre-commit-config.yaml` with version constraints
* Update `mean_average_precision.py` to remove redundant type ignore comments and refine `.pre-commit-config.yaml` by adding Python version and removing version constraints for `types-PyYAML` and `types-requests`.
* exclude Snyk badge URL

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: jirka <6035284+Borda@users.noreply.github.com>
2026-02-03 03:47:46 +01:00
uahroberto efbb5e2599
refactor(metrics): enforce strict typing, sanitize docs & fix numpy 2.0 compat (#2121)
* fix(pre_commit): 🎨 auto format pre-commit hooks
* refactor(metrics): enforce strict type safety and resolve mypy errors
- Fix incompatible types for Optional arguments in matching functions.
- Add explicit type annotations for empty lists and returns.
- Ensure numpy scalars are cast to native python floats.
- Extract variables to comply with line length limits (E501).
- Resolve 'Missing type parameters' for generic dicts and lists.

---------

Co-authored-by: RobertoHita <roberto.hita@edu.uah.es>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-02 17:59:18 +01:00
Jirka Borovec 6149bacc77
Fix and augment relative links in MD files to GitHub blob URLs (#2061)
* Add script to augment relative links in MD files to GitHub blob URLs
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Add type annotations to `augment_links.py` and update config
* Add `lychee-action` for link checking in CI workflows
* Apply suggestions from code review
* links in README.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-02 17:47:59 +01:00
Jirka Borovec 86b268d396
Update `pyproject.toml`: simplify license field and remove legacy (#2124) 2026-02-02 17:13:31 +01:00
Jirka Borovec a5b51a11e5
Chore CI by adding checks for links and references (#2113)
* Chore CI by adding checks for links and references
* Potential fix for code scanning alert no. 6: Workflow does not contain permissions
* Fix markdown image formatting in metrics documentation
* Update all `docs` links to use absolute URLs and fix broken references in documentation and workflows.
* Fix broken `albumentations` links in dataset processing documentation
* lycheeVersion: v0.22.0
* Refactor CI link check workflow to use lychee config file for cleaner argument management
* add TODOs for future file type support
* Fix header formatting for example plots across metric files

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-02 17:01:19 +01:00
Jesús Royeth 2b1abb1f5b
fix(line_zone): tracker-id reuse across classes (#1868)
* fix(line_zone): index crossing state by (tracker_id, class_id)
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Refactor `test_line_zone_tracker_id_reuse_with_different_classes` to use `pytest.mark.parametrize` for improved readability and test coverage.
* Refactor `pytest.mark.parametrize` arguments in `test_line_counter` for improved readability.
* Refactor `pytest.mark.parametrize` in `test_line_counter` to include `pytest.param` for clearer test case descriptions and improved readability.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: jirka <6035284+Borda@users.noreply.github.com>
2026-02-02 14:23:47 +01:00
Jirka Borovec cfaea751f2
Refactor metric tests with fixtures and improved structure and clarity (#2123)
* Refactor metric test files by encapsulating fixtures and improved structure and clarity
* Update `test/metrics/conftest.py` fixture values to refine test case coverage
2026-02-02 12:18:10 +01:00
Dhiego Pagotto 6e8e6fb276
add unit tests for precision, recall and f1_score metrics (#2119)
* add unit tests for precision, recall and f1_score metrics

These 3 metrics had zero test coverage. Created comprehensive tests
covering all main scenarios like perfect matches, partial overlaps,
empty cases, multiple classes and different iou thresholds.

All tests validate results mathematically and cover edge cases.
Tests follow the existing code style and use pytest parametrize
for different averaging methods.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: jirka <6035284+Borda@users.noreply.github.com>
2026-02-02 11:40:43 +01:00
jirka 6c2c3f8862 Convert various modules' type annotations + docstring examples to align with `numpy.typing` & fix linting 2026-02-02 18:10:37 +09:00
jirka 64acee9bec Convert `supervision/utils/image.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 5f17003f17 Convert `supervision/utils/internal.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka cda79458a9 Convert `supervision/utils/iterables.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 566844f591 Convert `supervision/utils/notebook.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 4c35dee692 Convert `supervision/utils/file.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka e2ca285610 Convert `supervision/metrics/recall.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka c999fad06f Convert `supervision/metrics/precision.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka a542406945 Convert `supervision/metrics/mean_average_recall.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 00a123b5fb Convert `supervision/metrics/mean_average_precision.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 3d939fd4a2 Convert `supervision/metrics/f1_score.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka f005ea1d17 Convert `supervision/metrics/detection.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka f6326d5590 Convert `supervision/key_points/core.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka b4262bb08e Convert `supervision/key_points/annotators.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka a9dad95fa7 Convert `supervision/geometry/utils.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 91ff090168 Convert `supervision/draw/utils.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 6d68a825ab Convert `supervision/draw/color.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 2043ba7feb Convert `supervision/detection/utils/vlms.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 5ac08abcf3 Convert `supervision/detection/utils/masks.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 1c37d143b4 Convert `supervision/detection/utils/iou_and_nms.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka f78b891011 Convert `supervision/detection/utils/converters.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka f2fc5b2952 Convert `supervision/detection/utils/boxes.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 09565ddacd Convert `supervision/detection/tools/csv_sink.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 780db7520d Convert `supervision/dataset/utils.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka fd9083ae76 Convert `supervision/dataset/core.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka ebe3fd4d2f Convert `supervision/classification/core.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka ce4204adc1 Convert `supervision/assets/downloader.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka 48450b5da3 Convert `supervision/annotators/utils.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
jirka fbd6f4dc5a Convert `supervision/annotators/core.py` docstrings to doctests
---

Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
2026-02-02 18:10:37 +09:00
Kader Miyanyedi 4c1f33189b
refactor(typing): Typing error has been fixed for draw and geometry files. (#2120) 2026-02-02 07:57:24 +01:00
Daniel dcce0e4807
test(detection): add adapter tests and ignore local data directory (#2116)
* test(detection): add adapter tests and ignore local data directory
* fix(pre_commit): 🎨 auto format pre-commit hooks
* chore: retrigger ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-02 07:56:04 +01:00
dependabot[bot] b8e88bf9c5
⬆️ Bump astral-sh/setup-uv in the github-actions group (#2122)
Bumps the github-actions group with 1 update: [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv).


Updates `astral-sh/setup-uv` from 7.2.0 to 7.2.1
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](61cb8a9741...803947b9bd)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 7.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-02 07:43:08 +01:00
realh4m 3b09a6356a
fix: `process_video` silent hang on callback error (#2022)
* Handle process_video worker exceptions
* test: add unit tests for process_video exception handling and fix docstring typo
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Handle `Full` exception in video writer queue and add test for small buffer scenario
* Apply suggestions from code review

---------

Co-authored-by: Your Name <realh4m@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-30 10:46:19 +01:00
Jirka Borovec 5ced8c4ea0
Add unit tests for `key_points` - skeleton & annotators (#2099)
* Refactor key point annotator tests to use reusable fixtures for test clarity and maintainability
* Apply suggestions from code review
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Move `assert_image_mostly_same` helper to a shared module and update imports in tests
* Update test/key_points/test_skeletons.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-29 18:22:19 +01:00