Skip to content

supervision-0.30.2

Latest

Choose a tag to compare

@Borda Borda released this 04 Sep 07:22

0.30.2: Detection numeric-correctness fixes

supervision 0.30.2 fixes three silent numeric-correctness bugs in the detection utilities β€” integer box areas that could wrap negative on large boxes, and two coordinate converters that truncated fractional values on integer input β€” plus an InferenceSlicer determinism fix that restores its documented source-order result guarantee under multithreading. A set of versioned-docs reliability fixes rounds out the release. No breaking API changes, no new public API.

✨ Spotlights / highlights

sv.Detections.box_area no longer overflows to a negative number

Integer-coordinate box area now computes in float64. A large int32 box (50000 x 50000) previously wrapped to a negative area.

detections = sv.Detections(xyxy=np.array([[0, 0, 50000, 50000]], dtype=np.int32))
detections.box_area  # array([2.5e+09]) β€” was negative before the fix

xcycwh_to_xyxy / denormalize_boxes stop truncating integer boxes

Both converters wrote fractional half-extent or scaled coordinates into a copy of the integer input, silently truncating toward zero β€” relevant when converting quantized VLM output (e.g. boxes on a 0..1000 grid).

xcycwh_to_xyxy(np.array([[10, 10, 5, 5]], dtype=np.int32))
# array([[ 7.5,  7.5, 12.5, 12.5]]) β€” the fractional coordinate 7.5 is no longer truncated to 7

InferenceSlicer merges results in source order under multithreading

Slice results now merge in source order under thread_workers > 1, restoring the ordering guarantee its docstring documents. Row order β€” and, for tied confidences, which overlapping box survives with_nms/with_nmm β€” no longer varies between runs on identical input.

πŸ”„ Migration guide

No breaking API changes, but three fixes above change return dtype for integer input:

  • sv.Detections.box_area / .area β€” integer xyxy now returns float64 (was the input's integer dtype, which could silently overflow)
  • sv.xcycwh_to_xyxy β€” integer input now returns float64 (was truncated integer output)
  • sv.denormalize_boxes β€” integer input now returns float64 (was truncated integer output)

If your code indexes arrays with these outputs (e.g. image[y1:y2, x1:x2]), a float64 result raises TypeError: slice indices must be integers. Cast explicitly where integer indices are required: xcycwh_to_xyxy(boxes).astype(int).

πŸ“ Notable changes

πŸ”§ Fixed

  • sv.Detections.box_area (and sv.Detections.area for axis-aligned boxes) now computes integer-coordinate box areas in float64, preventing integer overflow for large boxes. (#2514)
  • sv.xcycwh_to_xyxy no longer truncates coordinates for integer input arrays. (#2515)
  • sv.denormalize_boxes no longer truncates coordinates for integer input arrays. (#2516)
  • sv.InferenceSlicer now merges slice results in source order when thread_workers > 1, restoring the ordering guarantee its docstring documents. (#2517)
  • Docs deployment for latest no longer fails with error: version 'latest' already exists when latest exists as an alias of a released version. (#2512, #2513)
  • Versioned documentation builds now emit a valid /latest/search/ SearchAction URL when Mike removes the trailing slash from site_url; docs CI renders the custom theme under Mike version contexts to protect the URL, version banners, and star JSON-LD. Applies to future builds going forward. (#2529)
  • Versioned documentation banners now adjust MkDocs Material's desktop sidebar inline layout and scroll height without shifting the mobile navigation drawer. (#2532)
  • Versioned documentation deploys now export the version being built, so the outdated-version banner reaches readers of the develop tree; the workflow also now backs up the pre-rewrite gh-pages tip to a timestamped branch before committing over it. Applies to future builds going forward. (#2533)
  • The canonical-backfill workflow now reports (in the job summary) rewritten canonicals whose target page does not exist under latest/, and backfills the outdated-version banner itself into already-published archive trees, patching the empty banner markup those pages already carry rather than rebuilding them. (#2534)

πŸ† Contributors

  • Advait Shukla (@AdvaitS) β€” fixed integer overflow in box_area
  • Guillaume Flambard (@guillaume-flambard, LinkedIn) β€” fixed integer truncation in denormalize_boxes and xcycwh_to_xyxy
  • Roshan Sharma (@roshaninfordham, LinkedIn) β€” fixed InferenceSlicer result ordering under multithreading
  • Jirka Borovec (@Borda, LinkedIn) β€” versioned-docs banner layout, MIKE_DOCS_VERSION export, gh-pages backup, and canonical-backfill fixes (#2529, #2532, #2533, #2534)

Full changelog: 0.30.1...0.30.2