FastRCNNConfig
ModelConfigFastRCNNConfig(num_classes: int = 80, in_channels: int = 3, roi_size: int = 7, spatial_scale: float = 1.0 / 16.0, dropout: float = 0.5, bbox_reg_weights: tuple[float, float, float, float] = (10.0, 10.0, 5.0, 5.0), score_thresh: float = 0.05, nms_thresh: float = 0.3, max_detections: int = 300, batch_size_per_image: int = 64, positive_fraction: float = 0.25, fg_iou_thresh: float = 0.5, bg_iou_thresh_lo: float = 0.1)Configuration for Fast R-CNN.
Fast R-CNN (Girshick, ICCV 2015) runs the CNN on the full image once, then extracts per-proposal features with RoI Pooling on the shared feature map. This is the key advance over R-CNN (one forward pass vs one per proposal).
Default backbone: VGG16 conv layers (conv1_1 … conv5_3, pool5 removed). The feature map stride is 16 (four max-pool layers before pool5).
Args:
num_classes: Foreground object classes. Background is class 0,
giving (num_classes + 1) output logits.
in_channels: Input image channels (3 for RGB).
roi_size: RoI Pool output spatial size (paper: 7 → 7×7).
spatial_scale: Ratio of feature-map size to input image size.
For VGG16 with pool5 removed: 1/16.
dropout: Dropout probability after fc6 and fc7.
bbox_reg_weights: Per-component weight scaling for bbox regression
targets (tx, ty, tw, th). The paper states no
target normalisation; the (0, 0, 0, 0) mean /
(0.1, 0.1, 0.2, 0.2) std these weights invert
comes from the authors' released code
(BBOX_NORMALIZE_STDS), which every later
two-stage detector inherited.
score_thresh: Minimum class score at inference time.
nms_thresh: Per-class NMS IoU threshold.
max_detections: Maximum detections returned per image.
-- Training-time RoI sampling (§2.3) -- batch_size_per_image: RoIs sampled per image for the loss (64). positive_fraction: Target foreground share of that minibatch (0.25). A shortfall of foreground is backfilled with background so the minibatch keeps its size. fg_iou_thresh: IoU at or above which a proposal is foreground. bg_iou_thresh_lo: Lower edge of the hard-negative band; proposals below it are ignored entirely rather than treated as background.
Examples
>>> from lucid.models.vision.fast_rcnn._config import FastRCNNConfig
>>> cfg = FastRCNNConfig()
>>> cfg.model_type
'fast_rcnn'
>>> cfg.num_classes, cfg.in_channels
(80, 3)Used by 3
Constructors
1__init__
→None__init__(num_classes: int = 80, in_channels: int = 3, roi_size: int = 7, spatial_scale: float = 1.0 / 16.0, dropout: float = 0.5, bbox_reg_weights: tuple[float, float, float, float] = (10.0, 10.0, 5.0, 5.0), score_thresh: float = 0.05, nms_thresh: float = 0.3, max_detections: int = 300, batch_size_per_image: int = 64, positive_fraction: float = 0.25, fg_iou_thresh: float = 0.5, bg_iou_thresh_lo: float = 0.1)