data
ObjectDetectionOutput
extends
ModelOutputObjectDetectionOutput(logits: Tensor, pred_boxes: Tensor, loss: Tensor | None = None, hidden_states: tuple[Tensor, ...] | None = None, proposals: tuple[Tensor, ...] | None = None, objectness: Tensor | None = None)Output of any {Family}ForObjectDetection model.
Attributes
logitsTensorPer-proposal / per-query class logits. Shape depends on family:
(B, num_queries, num_classes) for DETR, (N, num_classes)
for R-CNN-family per-RoI scoring.pred_boxesTensorPredicted bounding box coordinates. Box format is family-specific
(cxcywh-normalised for DETR, xyxy-pixel for R-CNN).
loss(Tensor or None, optional)Total detection loss (classification + box regression + matching
cost where applicable) when targets were supplied.
hidden_states(tuple[Tensor, ...] or None, optional)Optional intermediate feature maps.
proposals(tuple[Tensor, ...] or None, optional)Per-image RoI proposals for two-stage detectors (R-CNN / Fast
R-CNN / Faster R-CNN). Lets downstream
postprocess() run
from the output alone, without re-running the proposal stage.objectness(Tensor or None, optional)(B, num_anchors) per-anchor objectness probability for the
single-stage YOLO family. A YOLO detection score is
,
so postprocess needs this alongside logits; without it the
class score alone would rank and threshold every background anchor.Notes
Returned by AutoModelForObjectDetection registrations —
R-CNN family, DETR, EfficientDet, YOLO v1–v4. Anchor-based and
set-prediction families share this contract.
Examples
>>> import lucid
>>> from lucid.models import ObjectDetectionOutput
>>> out = ObjectDetectionOutput(
... logits=lucid.zeros(1, 100, 92),
... pred_boxes=lucid.zeros(1, 100, 4),
... )
>>> out.logits.shape, out.pred_boxes.shape
((1, 100, 92), (1, 100, 4))
proposals and objectness carry the two-stage detectors'
intermediate results and stay empty for a single-stage one.
>>> out.proposals is None, out.objectness is None
(True, True)