rcnn(pretrained: bool = False, overrides: object = {})R-CNN with AlexNet backbone (Girshick et al., CVPR 2014).
Builds a RCNNForObjectDetection with the paper-cited AlexNet
topology: five-conv trunk applied to each region proposal warped to
, followed by two FC layers and sibling
classification (num_classes + 1) and class-specific bounding-box
regression (4 \cdot num_classes) heads. Original PASCAL VOC 2010
test mAP of 53.3% (paper Table 9) — a ~20-point jump over the prior
DPM state of the art.
Model Size
Parameters
pretrainedbool= False**overridesobject= {}RCNNConfig (e.g.
num_classes=20 for PASCAL VOC, score_thresh=0.3 for a
tighter inference threshold, roi_size=224 to match a
non-default backbone receptive field).Returns
RCNNForObjectDetectionDetector with the AlexNet R-CNN configuration applied (or with
overrides merged on top of it).
Notes
See Girshick et al., "Rich Feature Hierarchies for Accurate Object
Detection and Semantic Segmentation", CVPR 2014 (arXiv:1311.2524).
Region proposals must be supplied externally to forward —
the original paper uses selective search (~2000 proposals per image),
but any class-agnostic proposal method works. At inference, classes
are scored via softmax over the logits and bounding
boxes are refined per top-class delta:
Examples
>>> import lucid
>>> from lucid.models.vision.rcnn import rcnn
>>> model = rcnn(num_classes=20) # PASCAL VOC
>>> x = lucid.randn(1, 3, 600, 600)
>>> proposals = [lucid.tensor(
... [[10.0, 10.0, 200.0, 200.0],
... [50.0, 60.0, 300.0, 280.0]])]
>>> out = model(x, proposals)
>>> out.logits.shape
(2, 21)