EfficientDetConfig
ModelConfigEfficientDetConfig(num_classes: int = 80, in_channels: int = 3, phi: int = 0, backbone_in_channels: tuple[int, int, int] = (40, 112, 320), backbone_width_coeff: float = 1.0, backbone_depth_coeff: float = 1.0, fpn_channels: int = 64, fpn_repeats: int = 3, head_repeats: int = 3, anchor_scales: tuple[float, ...] = (1.0, 2.0 ** (1.0 / 3.0), 2.0 ** (2.0 / 3.0)), anchor_ratios: tuple[float, ...] = (0.5, 1.0, 2.0), anchor_base_sizes: tuple[int, ...] = (32, 64, 128, 256, 512), focal_alpha: float = 0.25, focal_gamma: float = 1.5, box_loss_weight: float = 50.0, focal_prior_prob: float = 0.01, iou_fg_thresh: float = 0.5, iou_bg_thresh: float = 0.4, image_size: int = 512, score_thresh: float = 0.05, nms_thresh: float = 0.5, max_detections: int = 100)Configuration for EfficientDet.
EfficientDet (Tan et al., CVPR 2020) applies compound scaling to object detection. Each compound coefficient φ jointly scales the backbone (EfficientNet-Bφ), the BiFPN width/depth, and the prediction head depth/resolution.
Architecture overview: Image → EfficientNet backbone (P3–P7 feature maps) → BiFPN (D_bifpn repeats, W_bifpn channels, fast normalised fusion) BiFPN outputs (P3–P7) → Class prediction head (shared conv) → Box prediction head (shared conv)
BiFPN fast-normalised fusion: weight_i / (ε + Σ weight_j) — learnable positive weights (ε=1e-4)
Args: num_classes: Foreground classes (background not counted separately — EfficientDet uses sigmoid + focal loss). in_channels: Input image channels.
-- Compound scaling (φ = 0–7) -- phi: Compound coefficient index. Default 0 (EfficientDet-D0).
-- Backbone (EfficientNet-B0–B7 widths/depths) -- backbone_width_coeff: Width multiplier (EfficientNet channel scaling). backbone_depth_coeff: Depth multiplier (EfficientNet block repeat). backbone_in_channels: Channel widths of the three backbone stages the BiFPN taps (C3, C4, C5), before its lateral 1x1s.
-- BiFPN -- fpn_channels: BiFPN channel width (W_bifpn). fpn_repeats: Number of BiFPN stacking repetitions (D_bifpn).
-- Prediction heads -- head_repeats: Depth of class/box conv heads (D_head).
-- Anchors --
anchor_scales: Size multipliers applied at every level. The
default is the octave subdivision the paper uses,
2 ** (0/3), 2 ** (1/3), 2 ** (2/3) — the subdivisions are
these values, not a separate count.
anchor_ratios: Anchor aspect ratios.
anchor_base_sizes: Base anchor edge length per pyramid level, in
input pixels. Scaled by anchor_scales to give the
anchors of that level.
image_size: Input resolution the anchors and strides are
defined against; the compound scaling ties it to phi.
-- Loss -- focal_alpha: Focal-loss class balance (paper: 0.25). focal_gamma: Focal-loss focusing exponent (paper: 1.5). box_loss_weight: Multiplier on the box term of the total loss (50). focal_prior_prob: Class-head bias prior probability (0.01). iou_fg_thresh: IoU at or above which an anchor is foreground. iou_bg_thresh: IoU below which an anchor is background; the [bg, fg) band is ignored by the class loss.
-- Inference -- score_thresh: Minimum sigmoid class score. nms_thresh: Per-class NMS threshold. max_detections: Maximum detections per image.
Examples
>>> from lucid.models.vision.efficientdet._config import EfficientDetConfig
>>> cfg = EfficientDetConfig()
>>> cfg.model_type
'efficientdet'
>>> cfg.num_classes, cfg.image_size
(80, 512)Used by 3
Constructors
1__init__
→None__init__(num_classes: int = 80, in_channels: int = 3, phi: int = 0, backbone_in_channels: tuple[int, int, int] = (40, 112, 320), backbone_width_coeff: float = 1.0, backbone_depth_coeff: float = 1.0, fpn_channels: int = 64, fpn_repeats: int = 3, head_repeats: int = 3, anchor_scales: tuple[float, ...] = (1.0, 2.0 ** (1.0 / 3.0), 2.0 ** (2.0 / 3.0)), anchor_ratios: tuple[float, ...] = (0.5, 1.0, 2.0), anchor_base_sizes: tuple[int, ...] = (32, 64, 128, 256, 512), focal_alpha: float = 0.25, focal_gamma: float = 1.5, box_loss_weight: float = 50.0, focal_prior_prob: float = 0.01, iou_fg_thresh: float = 0.5, iou_bg_thresh: float = 0.4, image_size: int = 512, score_thresh: float = 0.05, nms_thresh: float = 0.5, max_detections: int = 100)