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 fixxcycwh_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 7InferenceSlicer 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β integerxyxynow returnsfloat64(was the input's integer dtype, which could silently overflow)sv.xcycwh_to_xyxyβ integer input now returnsfloat64(was truncated integer output)sv.denormalize_boxesβ integer input now returnsfloat64(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(andsv.Detections.areafor axis-aligned boxes) now computes integer-coordinate box areas infloat64, preventing integer overflow for large boxes. (#2514)sv.xcycwh_to_xyxyno longer truncates coordinates for integer input arrays. (#2515)sv.denormalize_boxesno longer truncates coordinates for integer input arrays. (#2516)sv.InferenceSlicernow merges slice results in source order whenthread_workers > 1, restoring the ordering guarantee its docstring documents. (#2517)- Docs deployment for
latestno longer fails witherror: version 'latest' already existswhenlatestexists 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 fromsite_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
developtree; the workflow also now backs up the pre-rewritegh-pagestip 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_boxesandxcycwh_to_xyxy - Roshan Sharma (@roshaninfordham, LinkedIn) β fixed
InferenceSlicerresult ordering under multithreading - Jirka Borovec (@Borda, LinkedIn) β versioned-docs banner layout,
MIKE_DOCS_VERSIONexport,gh-pagesbackup, and canonical-backfill fixes (#2529, #2532, #2533, #2534)
Full changelog: 0.30.1...0.30.2