EfficientDetForObjectDetection
PretrainedModelEfficientDetForObjectDetection(config: EfficientDetConfig)EfficientDet object detector (Tan et al., CVPR 2020).
A family of compound-scaled single-stage detectors combining an EfficientNet backbone, a BiFPN (bidirectional weighted feature pyramid) neck, and shared classification + box regression heads applied to 5 feature levels (P3-P7). The family is parameterised by a compound coefficient that simultaneously scales backbone depth / width, BiFPN width and repeat count, head depth, and input resolution — yielding D0-D7 variants that span ~4M to ~52M parameters and trade speed for accuracy along a Pareto-optimal curve.
Parameters
configEfficientDetConfigefficientdet_d0 through efficientdet_d7) for the
paper-cited compound-scaled variants.Attributes
configEfficientDetConfigbackbone_EfficientNetBackbonep3_proj, p4_proj, p5_projnn.Sequentialconfig.fpn_channels.p6_pool, p7_poolnn.MaxPool2dbifpnnn.ModuleListconfig.fpn_repeats _BiFPNLayer blocks performing
weighted bidirectional top-down + bottom-up feature fusion.cls_head, box_head_PredictionHeadconfig.head_repeats
3x3 separable convolutions; outputs K * num_anchors and
4 * num_anchors channels respectively._anchor_genAnchorGeneratorNotes
See Tan et al., "EfficientDet: Scalable and Efficient Object Detection", CVPR 2020 (arXiv:1911.09070). The BiFPN's defining feature is weighted feature fusion at each node:
with non-negative weights learned end-to-end (the paper calls this "fast normalized fusion"). Compound scaling follows
so D0 () trains on 512x512 inputs while D7 () uses 1536x1536. Training uses focal loss on the K-channel class output plus smooth- on box deltas.
Examples
>>> import lucid
>>> from lucid.models.vision.efficientdet import efficientdet_d0
>>> model = efficientdet_d0()
>>> x = lucid.randn(1, 3, 512, 512)
>>> out = model(x)
>>> out.logits.shape[-1], out.pred_boxes.shape[-1]
(90, 4)Used by 2
Constructors
1Instance methods
2forward(x: Tensor, targets: list[dict[str, Tensor]] | None = None)Run EfficientDet.
Parameters
Returns
ObjectDetectionOutputObjectDetectionOutput:
logits : (B, A, K) per-class sigmoid logits (A = total anchors).
pred_boxes: (B, A, 4) decoded xyxy boxes.
loss : focal + smooth-L1 when targets provided.
Per-class NMS on raw sigmoid predictions.
Returns list of per-image result dicts with "boxes", "scores", "labels".