Commit Graph

4734 Commits

Author SHA1 Message Date
Jirka Borovec 6f1eb63825
enable Prettier hook to pre-commit for YAML & TOML (#2142)
* add Prettier hook for consistent formatting YAML, and TOML files
* fix(pre_commit): 🎨 auto format pre-commit hooks

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-10 21:39:52 +09:00
dependabot[bot] e4d0be777d
⬆️ Bump astral-sh/setup-uv in the github-actions group (#2141)
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.1 to 7.3.0
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](803947b9bd...eac588ad8d)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 7.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  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-10 21:28:06 +09:00
Kader Miyanyedi 54328e37a0
fix(typing): update type hints for utility functions in detection module (#2140) 2026-02-10 21:27:23 +09:00
dependabot[bot] 3dd9e56da4
chore(deps-dev): bump nbconvert in the uv group across 1 directory (#2144)
Bumps the uv group with 1 update in the / directory: [nbconvert](https://github.com/jupyter/nbconvert).


Updates `nbconvert` from 7.16.6 to 7.17.0
- [Release notes](https://github.com/jupyter/nbconvert/releases)
- [Changelog](https://github.com/jupyter/nbconvert/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jupyter/nbconvert/compare/v7.16.6...v7.17.0)

---
updated-dependencies:
- dependency-name: nbconvert
  dependency-version: 7.17.0
  dependency-type: direct:development
  dependency-group: uv
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-10 21:24:57 +09:00
pre-commit-ci[bot] 6d35301672
chore(pre_commit): ⬆ pre_commit autoupdate (#2143)
* chore(pre_commit): ⬆ pre_commit autoupdate

updates:
- [github.com/tox-dev/pyproject-fmt: v2.12.1 → v2.14.2](https://github.com/tox-dev/pyproject-fmt/compare/v2.12.1...v2.14.2)
- [github.com/abravalheri/validate-pyproject: v0.24.1 → v0.25](https://github.com/abravalheri/validate-pyproject/compare/v0.24.1...v0.25)
- [github.com/astral-sh/ruff-pre-commit: v0.14.14 → v0.15.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.14...v0.15.0)

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-10 21:24:35 +09:00
Jirka Borovec 8e4fedf3f1
Add `match` arguments to all `pytest.raises` for more precise error validation in tests (#2145) 2026-02-10 21:22:55 +09:00
Shriya Sravani Yellapragada cd0aac2655
fix: add validation for RGB/BGR color values in Color class (#1984)
* fix: add validation for RGB/BGR color values in Color class

- Add range validation (0-255) to from_rgb_tuple() and from_bgr_tuple()
- Raise ValueError for invalid color values with descriptive messages
- Add comprehensive tests for both valid and invalid cases
- Update docstrings to document the new validation behavior

* 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: jirka <6035284+Borda@users.noreply.github.com>
2026-02-04 23:20:51 +09:00
Jirka Borovec 6969e7a78c
docs: fix copy doctests without `>>>` and `...` by button & ctr+c (#2138)
* Add custom JavaScript for copying Python REPL code examples without prompts and integrate it into the docs
* Enhance JavaScript copy button functionality to support `.md-code__button` and streamline clipboard handling
* Remove unused `pycon_copy.js` references and streamline JavaScript dependencies in docs and configuration
* Enhance `stripPythonPrompts` to handle triple-quoted strings in REPL code parsing

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-04 23:09:16 +09:00
jirka ea3a0e9a4e Wrap all docstrings in the package with ```pycon``` for compatibility with MKDocs examples rendering 2026-02-04 20:31:18 +09:00
jirka 53950fd426 Update and enhance `mkdocs.yml` with new features and configuration refinements 2026-02-04 20:31:18 +09:00
Jirka Borovec c67d977682
example/time_in_zone: Update requirements for inference package 2026-02-04 19:59:08 +09:00
Thomas Berends 5c5bfe5544
docs: update detection core with tips for using Gemini integration (#1925)
* docs: update detection core with tips for using Gemini integration
* 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: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-04 18:39:20 +09:00
jirka 0ebab21e9c Add priority instruction for PR reviews to Copilot guidelines 2026-02-04 18:25:18 +09:00
Copilot 6566063e2b
Normalize docstring argument sections and remove redundant types (#2133)
* chore: update docstrings typing and args headers

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Borda <6035284+Borda@users.noreply.github.com>
2026-02-04 18:14:28 +09:00
Jirka Borovec ecdbea340e
Add GitHub Copilot PR review guidelines to .github directory (#2134)
* Update GitHub Copilot PR review guidelines to `.github` directory
* 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-04 18:09:00 +09:00
Jirka Borovec 5ce6e484b8
Extend `supervision` modules' docstrings with doctests (#2132)
* Extend `supervision` modules' docstrings with doctests
* fix(pre_commit): 🎨 auto format pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-04 16:39:27 +09:00
Jirka Borovec 2d0404e67c
Extend docstrings to test cases for enhanced readability (#2130)
* Extend docstrings to test cases for enhanced readability and consistency across testing modules
* Extend test case docstrings across multiple modules for improved clarity and consistency
* Refactor test case docstrings for clarity and consistency in `test_annotators.py`

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-03 17:28:33 +01:00
M K Subrahmanya d89ebde4d1
docs: Fix outdated doc files (#1995)
* docs: Fix outdated doc files per issue #1920
* 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: jirka <6035284+Borda@users.noreply.github.com>
2026-02-03 16:52:55 +01:00
Piotr Skalski a897905955
fix "time in zone" demo and make it use RF-DETR (#1922)
* migrate YT video file download script to use `yt_dlp`; old script didn't work anymore
* RF-DETR file example works
* ultralytics stream example migrated to new inference
* migrate inference scripts to use RF-DETR-Medium
* RF-DETR naive stream example
* RF-DETR stream example
* updated README.md

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

* Migrate `time_in_zone` examples to use `jsonargparse` and update `--classes` argument format to accept lists
* Add licensing details for `ultralytics` and `supervision` in `README.md`

---------

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 15:57:36 +01:00
Jirka Borovec b8a2a6996c
refactor: reorganize project structure and update module imports (#2112)
* refactor: reorganize project structure and update module imports
* configure setuptools to use 'src' layout and adjust package discovery
* refactor: move tests to `tests` directory and update imports accordingly
* update lint and mypy configurations to align with `src` and `tests` structure
* update test imports to use corrected `tests.helpers` module path
* fix(pre_commit): 🎨 auto format pre-commit hooks
2026-02-03 15:24:47 +01:00
Adonai Vera 2ca9bee083
Human behavior with YOLO-World Cookbook (#915)
* Real application underestand visitors with yolo-world
* Improvements in the examples
* Small improvements in typing
* improve path video results
* 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: jirka <6035284+Borda@users.noreply.github.com>
2026-02-03 14:59:08 +01:00
jirka 6af1ab31f4 Add `codecov` badge to README and adjust badge arrangement 2026-02-03 14:18:44 +01:00
jirka 5b56d40ef9 Update lychee configuration to accept additional HTTP status codes (200, 408) 2026-02-03 14:04:42 +01:00
Jirka Borovec 2abdccbe1d
docs: Wrap all placeholder paths in quotes and code expressions (#2128)
* Wrap all placeholder paths in quotes across documentation and code examples for consistency
* Update pre-commit config to exclude `docs/deprecated.md` from mdformat check
2026-02-03 14:00:40 +01:00
Jirka Borovec d925cdf666
Standardize examples and error messages with `uv` CLI for virtual env. and dependency installation (#2129) 2026-02-03 13:59:35 +01:00
James c592cd9ff3
Add count in zone guide to `supervision` docs (#549)
* add count in zone guide to table of contents
* add count in zone docs
* respond to feedback
* fix(pre_commit): 🎨 auto format pre-commit hooks
* update count in zone example
* Apply suggestions from code review

---------

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-02-03 13:58:49 +01:00
Jirka Borovec 66c49b2e80
examples/traffic_analysis: improve CLI argument handling (#2059)
* refactor(traffic_analysis): improve CLI argument handling
* fix(pre_commit): 🎨 auto format pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-03 12:56:56 +01:00
Jirka Borovec 0efb55ec19
examples/tracking: improve CLI argument parsing (#2058)
* refactor(tracking): improve CLI argument parsing
* Apply suggestions from code review
* 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: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-03 12:52:50 +01:00
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