Skip to content

feature/initial-detections-api - #3

Merged
SkalskiP merged 13 commits into
mainfrom
feature/initial-detections-api
Jan 19, 2023
Merged

SkalskiP merged 13 commits into
mainfrom
feature/initial-detections-api

Conversation

@SkalskiP

Copy link
Copy Markdown
Collaborator

Description

  • Initial version Detections and BoxAnnotator added

…into feature/initial-detections-api

# Conflicts:
#	supervision/draw/color.py
…into feature/initial-detections-api

# Conflicts:
#	supervision/tools/detections.py
…into feature/initial-detections-api

# Conflicts:
#	supervision/tools/detections.py
…into feature/initial-detections-api

# Conflicts:
#	supervision/tools/detections.py
…into feature/initial-detections-api

# Conflicts:
#	supervision/tools/detections.py
…into feature/initial-detections-api

# Conflicts:
#	supervision/tools/detections.py
…into feature/initial-detections-api

# Conflicts:
#	supervision/tools/detections.py
@SkalskiP
SkalskiP merged commit e1008b9 into main Jan 19, 2023
@SkalskiP
SkalskiP deleted the feature/initial-detections-api branch August 8, 2023 09:12
Borda added a commit that referenced this pull request Mar 30, 2026
[resolve #3] Review comment by @copilot (PR #2185):
"isinstance(..., int) won't fail if iscrowd is a bool (bool subclasses int)"
Borda added a commit that referenced this pull request Mar 30, 2026
- Break error message string at line 686 to stay within 88-char ruff E501 limit
- Add explicit npt.NDArray[np.float32] | None annotation on conf_selected; use
  cast() at the branch assignment to prevent mypy widening to Optional[Any]
  (mypy 1.19.1 + numpy 2.x stubs treat npt.NDArray as Any, so narrowing via
  `if conf_selected is not None` requires a concrete type from cast, and the
  self.confidence access needs its own is-not-None guard inside the loop)

[resolve #1] /review finding by sw-engineer (report: _outputs/2026/03/output-review-2026-03-30-5.md):
"conf_selected inferred as Optional[Any]; mypy pre-commit hook fails"
[resolve #3] /review finding by linting-expert (report: _outputs/2026/03/output-review-2026-03-30-5.md):
"ruff E501: line too long (89 > 88) at core.py:686"

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request Mar 31, 2026
- [resolve #1] RUF015: replace list(annotations.values())[0] with next(iter(annotations.values()))
- [resolve #2] E501: split assertion message to stay within 88-char limit
- [resolve #3] ruff format: committed formatted diff for test file

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request Apr 13, 2026
Restores the int() cast that was present in the old frame_rate formula,
guarding against callers passing a float (e.g. track_seconds * fps).

[resolve #3] Review comment by @Copilot (gh): max_time_lost was explicitly int(...)  before; callers who pass a non-int lost_track_buffer would silently produce a float.

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request Apr 13, 2026
- test_byte_tracker_lost_track_buffer_reacquires_within_buffer: track absent
  fewer frames than the buffer is reacquired with the same tracker id
- test_byte_tracker_lost_track_buffer_expires_track: track absent more frames
  than the buffer gets a new id on re-detection
- test_byte_tracker_lost_track_buffer_accepts_float: float input is coerced to
  int without raising

[resolve #3] Review comment by @Copilot (gh): no tests asserting new behavior of lost_track_buffer...

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit to farukalamai/supervision that referenced this pull request Apr 13, 2026
Adds a parametrized case to test_json_sink verifying that np.ndarray
values in custom_data are sliced per detection row (not written as the
full array on every row). Mirrors the existing CSV counterpart added
by the original PR.

[resolve roboflow#3] /review finding by qa-specialist (report: .temp/output-review-fix-csv-json-sink-custom-data-array-slicing-2026-04-13.md): Missing JSONSink test for numpy array custom_data slicing

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request Apr 15, 2026
- Replace FutureWarning with warn_deprecated (SupervisionWarnings) in
  Detections.from_lmm to respect SUPERVISON_DEPRECATION_WARNING env var
- Align removal version from 0.30.0 to 0.31.0 for consistency with
  all other deprecations introduced in this PR

[resolve #3] Review comment by @copilot (PR #2214):
"Deprecation warning says from_lmm will be removed in supervision-0.30.0..."
[resolve #4] Review comment by @copilot (PR #2214):
"Emitting deprecation warnings with the standard FutureWarning here byp..."

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request Apr 15, 2026
- Replace FutureWarning with warn_deprecated (SupervisionWarnings) in
  Detections.from_lmm to respect SUPERVISON_DEPRECATION_WARNING env var
- Align removal version from 0.30.0 to 0.31.0 for consistency with
  all other deprecations introduced in this PR

[resolve #3] Review comment by @copilot (PR #2214):
"Deprecation warning says from_lmm will be removed in supervision-0.30.0..."
[resolve #4] Review comment by @copilot (PR #2214):
"Emitting deprecation warnings with the standard FutureWarning here byp..."

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit to shaun0927/supervision that referenced this pull request Apr 17, 2026
…NSink

- Document list/tuple slicing vs. broadcast semantics, Args, and Returns

[resolve roboflow#3] /review finding by foundry:doc-scribe (report: .temp/output-review-fix-sinks-slice-list-values-2026-04-17.md)

---
Co-authored-by: Claude Code <[email protected]>
Co-authored-by: OpenAI Codex <[email protected]>
Borda added a commit to shaun0927/supervision that referenced this pull request Apr 17, 2026
… in fallback

- Wrap splprep/splev in try/except ValueError so collinear unique
  points (e.g. perfectly straight-line motion) fall back to the raw
  polyline instead of crashing.
- Use unique_xy (deduplicated) instead of raw xy for the fallback
  spline_points assignment, making both paths semantically consistent.

[resolve roboflow#3] /review finding by sw-engineer (report: collinear splprep crash)
[resolve roboflow#4] /review finding by sw-engineer (report: fallback uses un-deduplicated xy)

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request Apr 22, 2026
…ized RLE

- test_base48_round_trip: add [100], [1000] (multi-byte continuation),
  [-3], [-1, 0, -100] (negative values exercising sign-bit path)
- test_rle_counts_to_mask: add case where sum(rle) > h*w to cover
  truncation via flat[:num_pixels]

[resolve #3] /review finding by qa-specialist (report: .temp/output-review-rle-refactor-2026-04-22.md):
"Missing test coverage for multi-byte base-48 values, negative delta values..."

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request Apr 22, 2026
- Rename TestResize → TestCompactMaskResize for naming consistency with
  other test classes in test_compact_mask.py
- Add test_join_true_true_junction_no_zero_run targeting the True/True
  boundary merge introduced in the prior fix
- Move _PARALLEL_THRESHOLD to module level alongside _L3_DENSITY_THRESHOLD
- Cap ThreadPoolExecutor max_workers=min(n, os.cpu_count() or 4) to avoid
  thread contention in library code
- Document identity-resize shallow-copy semantics in inline comment

[resolve #3] @Copilot (gh): "TestResize is a very generic class name..."
[resolve #9] /review by sw-engineer: "_PARALLEL_THRESHOLD constant buried in method body"
[resolve #10] /review by sw-engineer: "ThreadPoolExecutor() with no max_workers argument"
[resolve #11] /review by sw-engineer: "identity resize does shallow copy of list(self._rles)"
[resolve #12] /review by qa-specialist: "_rle_join_cols has no test for True/True junction"

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request Apr 30, 2026
[resolve #3] Review comment by @Copilot (PR #2241):
"The Colab badge link points to `.../blob/develop/notebooks/release-demo_0-28.ipynb`..."

---
Co-authored-by: Claude Code <[email protected]>
Co-authored-by: OpenAI Codex <[email protected]>
Borda added a commit to satishkc7/supervision that referenced this pull request May 19, 2026
…alist (report: .reports/review/2026-05-19T10-05-17Z/review-report.md): add _mux_audio happy-path and exception-branch tests

- test_mux_audio_moves_file_on_success: mock subprocess.run returncode=0;
  assert shutil.move is called once with video_path as destination — catches
  any regression that drops the move call after a successful ffmpeg run
- test_mux_audio_swallows_subprocess_exception: mock subprocess.run raising
  OSError; assert no exception escapes _mux_audio and original file is intact
- Fix failed_result.stderr = b"" in test_mux_audio_warns_on_ffmpeg_failure
  to match the updated _mux_audio which now decodes result.stderr

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request May 22, 2026
…nt uint8 truncation

np.asarray(icon, dtype=np.uint8) would silently truncate 16-bit PNG icons;
cast() is a typing-only no-op that preserves source data unchanged.

[resolve #3] /review finding by foundry:challenger (report: .reports/review/2026-05-22T05-56-29Z/review-report.md)

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request May 22, 2026
Verifies force_masks=True produces the same merged mask as the default
auto-detection path (_with_seg_mask). Demonstrates both code paths reach
the multi-segment merge logic correctly.

Resolves [resolve #3] /review finding by foundry:challenger (report:
.reports/review/2026-05-22T17-57-39Z/review-report.md):
drop force_masks=True; verify auto-detection path

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit to madhavcodez/supervision that referenced this pull request May 22, 2026
Documents new starting_image_id/starting_annotation_id params and the
None → tuple[int, int] return type change so downstream users can audit.

[resolve roboflow#3] /review finding by foundry:doc-scribe (report: .reports/review/2026-05-22T18-44-11Z/review-report.md):

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit to Ace3Z/supervision that referenced this pull request May 27, 2026
… and from_vlm paths

from_ultralytics empty path returned cls.empty() with data={} — detections["class_name"]
returned None instead of an empty string array. Same bug in from_vlm Florence-2 branch.
Both now return data={CLASS_NAME_DATA_FIELD: np.empty(0, dtype=str)}, consistent with
the from_inference fix.

[resolve roboflow#3] /review finding by foundry:challenger (report: .reports/review/2026-05-27T06-06-27Z/review-report.md)

---
Co-authored-by: Claude Code <[email protected]>
Borda added a commit that referenced this pull request Jun 4, 2026
[resolve #3] Review by @Copilot (PR #2290):
"In validate_xy, the expected_shape string for the fixed-m case is incorre..."
Challenge: evidence=VALID suggestion=VALID resolution=as-suggested

---
Co-authored-by: Claude Code <[email protected]>
Co-authored-by: OpenAI Codex <[email protected]>
Borda added a commit to kounelisagis/supervision that referenced this pull request Jun 8, 2026
- [resolve roboflow#3] with_nmm: for OBB merge groups with >1 member, set merged
  xyxy from winner's OBB corners instead of union AABB of all members.
  Challenge: evidence=VALID suggestion=VALID resolution=as-suggested
- [resolve roboflow#6] with_nms + with_nmm docstrings: document three-path dispatch
  order (mask → OBB → AABB) so callers know OBB is now routed differently.
  Challenge: evidence=VALID suggestion=VALID resolution=as-suggested
- [resolve roboflow#11] with_nmm: cast OBB to float32 (was float64), aligning with
  with_nms; relax _group_overlapping_oriented_boxes annotations to np.floating.
  Challenge: evidence=VALID suggestion=VALID resolution=as-suggested

[resolve group] PR roboflow#2303 — items 3, 6, 11

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: OpenAI Codex <[email protected]>
Borda added a commit to kounelisagis/supervision that referenced this pull request Jun 8, 2026
- [resolve roboflow#4] test_with_nmm_falls_back_to_box_nmm_without_obb_data: regression
  guard that non-OBB Detections still collapse via box NMM path.
  Challenge: evidence=VALID suggestion=VALID resolution=as-suggested
- [resolve roboflow#10] boundary tests: empty/single, iou_threshold=0.0/1.0, IOS metric
  end-to-end NMS, and OBB NMM empty/single — converted threshold test to
  parametrize(expected_keep) removing if-branch from test body.
  Challenge: evidence=VALID suggestion=VALID resolution=as-suggested
- Added test_with_nmm_obb_merged_xyxy_matches_winner_aabb verifying the
  item roboflow#3 contract: merged xyxy == winner's AABB, not union of all members.

[resolve group] PR roboflow#2303 — items 4, 10

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: OpenAI Codex <[email protected]>
Borda added a commit that referenced this pull request Jun 16, 2026
- [resolve #3] add Added: sv.TkImageWindow entry with key differences
  from cv2 (wait_key return type, mouse signature, left-button-only)
- [resolve #2] replace 'resolver conflict' with accurate 'silent
  co-install with filesystem collision' — pip installs both wheels
  silently; whichever ran last wins; advise explicit uninstall
- [resolve #8] add python3-tk system package install instructions
  (apt-get / brew) in TkImageWindow entry

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Borda added a commit that referenced this pull request Jul 1, 2026
…spatch

- Add `_iter_mask_crops()` helper under shared-utilities seam: yields
  (detection_idx, mask_or_crop, offset_or_None) encapsulating the
  CompactMask vs dense isinstance dispatch in one place (eliminates 4th
  inline copy of the same pattern; see _paint_masks_by_area)
- Refactor PolygonAnnotator.annotate() to consume _iter_mask_crops;
  removes the 9-line inline dispatch block
- Add TODO comment at isinstance site flagging MaskLike Protocol as
  follow-up (separate PR; review item #3 self-resolved)
- Extend PolygonAnnotator.annotate() docstring with Note section
  covering CompactMask fast path and offset semantics

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Borda added a commit that referenced this pull request Jul 1, 2026
Use CompactMask crops for polygon extraction and offset crop-local contours back into image coordinates.

Add a regression test covering tight crops, disconnected contours, empty masks, dense parity, and no integer CompactMask indexing.

- Add `_iter_mask_crops()` helper under shared-utilities seam: yields
  (detection_idx, mask_or_crop, offset_or_None) encapsulating the
  CompactMask vs dense isinstance dispatch in one place (eliminates 4th
  inline copy of the same pattern; see _paint_masks_by_area)
- Refactor PolygonAnnotator.annotate() to consume _iter_mask_crops;
  removes the 9-line inline dispatch block
- Add TODO comment at isinstance site flagging MaskLike Protocol as
  follow-up (separate PR; review item #3 self-resolved)
- Extend PolygonAnnotator.annotate() docstring with Note section
  covering CompactMask fast path and offset semantics
- Add N=0 empty CompactMask test (scene unchanged, no error)
- Add all-False mask test (no polygons drawn, documents boundary behavior)
- Add N=1 single-detection parity test (CompactMask == dense)
- Add float xyxy truncation test (sub-pixel xyxy → same output as int xyxy)
- Add disjoint-contour coordinate assertion: both blobs painted at correct
  image-space coords after crop→image offset translation
- Add PolygonAnnotator to TestCompactMaskParity.test_annotator_compact_mask_matches_dense_mask parametrize

---------

Co-authored-by: Codex <[email protected]>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Borda added a commit to RubenHaisma/supervision that referenced this pull request Jul 1, 2026
…ocstring

- Broaden param types: `list[list[float]]` → `Sequence[Sequence[float]]`, `list[bool]` → `Sequence[bool]` (item roboflow#8)
- Add `from collections.abc import Callable, Sequence` import
- Add `Note:` block warning callers that this function uses `[x, y, w, h]` (COCO convention) while all sibling batch-IoU functions use xyxy (item roboflow#1)
- Document NaN propagation behaviour in the Note block (item roboflow#7)
- Fix `Returns` section: replace internal names `dt`/`gt` with public param names `boxes_detection`/`boxes_true`; add row/column orientation description (item roboflow#3)

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Borda added a commit that referenced this pull request Jul 3, 2026
…ring

- Remove "Legacy" from TestMeanAveragePrecisionBackgroundFalsePositives
  docstring — from_tensors is the active tensor constructor, not deprecated
- Add N=0 background-image contract to targets arg description in
  from_tensors docstring (empty array = all predictions are false positives)
- Add docstring example demonstrating that predictions on a background
  image produce map50=0.0 (covers new empty-stats code path)
- Fix Returns section: add MeanAveragePrecision type prefix per Google style

[resolve #3] /review finding by foundry:doc-scribe (report)
[resolve #5] /review finding by foundry:doc-scribe (report)
[resolve #7] /review finding by foundry:doc-scribe (report)
[resolve #8] /review finding by foundry:doc-scribe (report)

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Borda added a commit that referenced this pull request Jul 15, 2026
…back

[resolve group] PR #2432 — items 3 5

Item #3 (@Copilot): np.sort(..., axis=0) sorted x/y columns
independently, letting mismatched point sets appear equal. Now
sorts points lexicographically (row-wise) via np.lexsort.
Item #5 (@Copilot): filter_segments_by_distance calls
connectedComponentsWithStats, which was not monkeypatched to the
fallback, so the test silently used native OpenCV. Added the
missing monkeypatch alongside the existing ones.
Challenge: both evidence=VALID suggestion=VALID resolution=as-suggested

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Borda added a commit that referenced this pull request Jul 17, 2026
[resolve #3] Review by @Copilot (PR #2443):
"_validate_manifest() treats a line as a comment only if it starts with '..."
Challenge: evidence=VALID suggestion=VALID resolution=as-suggested

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Borda added a commit to mvanhorn/supervision that referenced this pull request Jul 20, 2026
[resolve group] PR roboflow#2374 — items 1, 2, 3, 7

Detection_area's dense-mask branch now delegates to the shared
count_mask_pixels SIMD-popcount helper instead of a duplicated
np.count_nonzero(axis=(1,2)) reduction, restoring the ~6x fast path
also used by metrics.utils.object_size (item roboflow#1).

Relocates detection_area/detection_iou from the pure-array
detection/utils/ package to detection/geometry_dispatch.py, since
both consume Detections objects rather than raw arrays — this also
resolves the module-name collision with the top-level
supervision.geometry package (item roboflow#2, item roboflow#7's module-rename part).

Documents detection_iou's shared-geometry, box-IoU-last-resort
fallback and its asymmetry vs detection_area's per-operand dispatch
(item roboflow#3). Renames detection_iou's detections_true/detections_detection
params to detections_a/detections_b — the sole caller passes two peer
merge candidates with no true/pred relationship (item roboflow#7's param-rename
part).

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: OpenAI Codex <[email protected]>
Borda added a commit to Ace3Z/supervision that referenced this pull request Jul 21, 2026
Narrow reader() to `except Exception` so KeyboardInterrupt/SystemExit no
longer masquerade as normal EOF (item roboflow#3). Document the RuntimeError
raised on decode/open failure, the GIL precondition for the prefetch
speedup, and the deferred error-delivery latency when prefetch>0
(items roboflow#4, roboflow#12).

[resolve roboflow#3,roboflow#4,roboflow#12] PR roboflow#2273 — Copilot (gh) + foundry:sw-engineer,
foundry:doc-scribe (review): reader-thread exception scope, RuntimeError
docs, GIL/benchmark/latency docstring hardening

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: OpenAI Codex <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant