Skip to main content

obb_loss

PyTorch oriented-box ProbIoU, L1, VFL/QFL, and Hungarian matching with packed tensors. Supports Python 3.11+, CPU/CUDA, and mixed precision inputs. Development uses Python 3.12.

import obb_loss as obb

criterion = obb.SetCriterion(obb.SetCriterionConfig(classification="none"))
result = criterion(preds, targets, reduction=obb.Reduction.NONE)
match result:
    case obb.Ok(value=losses):
        losses.total.mean().backward()
    case obb.Err(error=error):
        print(error)

PackedBatch(values, cu_seqlens) stores packed tensors and cumulative sample boundaries. Predictions(boxes: PackedBatch, logits) and Targets(boxes: PackedBatch, labels) keep geometry and classification roles explicit. Logits and labels follow box order and share its boundaries. Geometry is (cx, cy, w, h, cos(theta), sin(theta)). Pack dense decoder outputs with obb.pack_predictions; convert variable-length annotations with obb.pack_targets. Geometry-only callers can use obb.pack_boxes and obb.pack_dense_boxes. All checked helpers return typed Ok/Err values and preserve autograd.

SetCriterionConfig selects losses, numerical parameters, normalization, and training weights. MatcherConfig controls independent assignment weights and chunk limits. forward(preds, targets, reduction) supervises one layer; callers aggregate layers. Subclass classification_quality to supply matched VFL/QFL scores and choose their gradient policy. Subclass loss methods to replace formulas, or compute_losses to add named per-sample terms. Parameters and buffers use ordinary PyTorch registration.

Pure functions include stable_probiou, stable_probiou_loss, box_l1_loss, varifocal_loss, and quality_focal_loss. ProbIoULoss, VarifocalLoss, and QualityFocalLoss provide configured module interfaces. Stable ProbIoU computes in float64 with autocast disabled; checked APIs reject invalid numerical domains.

See set criterion, runnable examples, loss equations and papers, typing, and verification evidence.

Run just check for formatting, strict Ruff/Pyrefly checks, tests, and examples. just stress runs reproducible numerical simulations; just benchmark separates loss, validation, pairwise costs, and CPU assignment transfer/solve timing.

Metadata

Release files for obb-loss 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for obb-loss 0.11.0
File Interpreter ABI Platform Actions
obb_loss-0.11.0-py3-none-any.whl Python 3 none any Details for obb_loss-0.11.0-py3-none-any.whl

Release files / obb_loss-0.11.0-py3-none-any.whl

Download URL obb_loss-0.11.0-py3-none-any.whl
Size 56.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e760036f6937f11b1a346e93752521df19703b533da4c6259b1e4303e33f83a
BLAKE2b-256 checksum
How to use checksums
c5cfc37fe160378e526952c03b459fb1b60d1a33f8a12cf0808748e36e73af14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for obb-loss 0.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page