Faster R-CNN M

Click a block to read its description, or select it with Tab and Enter.

Faster R-CNN M800 × 800 RGB canvas; batch 1; eval. COCO: 91 internal slots mapped to 80 classes. R and N are data-dependent counts.LibreYOLOFaster R-CNN M800 × 800 RGB canvas; batch 1; eval. COCO: 91 internal slots mapped to 80 classes. R and N are data-dependent counts.Input transformRGB imageValues in [0,1]Channel normalizationMean .485/.456/.406; std .229/.224/.225Bilinear resizeMin edge 800; max edge 1333Pad right/bottom to multiple of 32Canvas unchanged for the selected square inputResNet-50 backboneInput3 × 800 × 800Conv2d 7×7, s=2, p=364 × 400 × 400; no biasFrozenBatchNorm2d + ReLU64 × 400 × 400; eps=0MaxPool2d 3×3, s=2, p=164 × 200 × 200C2: 1 projection + 2 identity blocks256 × 200 × 200; hidden 64C3: 1 projection + 3 identity blocks512 × 100 × 100; hidden 128C4: 1 projection + 5 identity blocks1024 × 50 × 50; hidden 256C5: 1 projection + 2 identity blocks2048 × 25 × 25; hidden 512Projection strides: C2=1, C3/C4/C5=2.The stride is in the bottleneck 3×3 convolution.Feature pyramidC5: Conv2d 1×12048 input; 256 × 25 squareConv2d 3×3, p=1F3: 256 × 25 squareC4: Conv2d 1×11024 input; 256 × 50 squareConv2d 3×3, p=1F2: 256 × 50 square+Nearest resize256 × 50 squareC3: Conv2d 1×1512 input; 256 × 100 squareConv2d 3×3, p=1F1: 256 × 100 square+Nearest resize256 × 100 squareC2: Conv2d 1×1256 input; 256 × 200 squareConv2d 3×3, p=1F0: 256 × 200 square+Nearest resize256 × 200 squareF3 continuation256 × 25 × 25MaxPool2d 1×1, s=2pool: 256 × 13 × 13RPN receives 5 feature maps. RoIAlign excludes the extra pooled map.FPN normalization: none; all FPN convs have bias.Region Proposal Network (RPN)Each FPN feature independently256 channels; shared RPN weightsConv2d 3×3 + ReLU256 channels; repeat 1; no normConv2d 1×13 objectness logits/locationConv2d 1×112 box deltas/locationTop-K per level, then sigmoid1000 pre-NMS proposals per levelFlatten anchor rowsWeights for box delta decode: 1,1,1,1Generate anchors3 per location; one size per levelDecode anchor-relative deltasCenter shift; exp sizes; clip log-scaleFilter proposals and level-wise NMSscore ≥ 0.0; NMS IoU 0.7Retain at most 1000 proposalsR × 4 boxes; R varies with image valuesAnchor ratios: 0.5, 1, 2. Sizes: 32, 64, 128, 256, 512.Raw anchor rows on this canvas: 159,882.Clip to canvas; remove boxes smaller than 0.001 pixels.Box size exponent clamp: log(1000/16).Box RoI head and final detection selectionSelected FPN featuresF0/F1/F2/F3 (strides4/8/16/32)RPN proposalsR × 4 boxesMultiScaleRoIAlignR × 256 × 7 × 7; sampling_ratio=2Flatten; Linear 12544 to 1024; ReLUR × 1024Linear 1024 to 1024; ReLUR × 1024Linear 1024 to 91R × 91 class logitsLinear 1024 to 364R × 91 × 4 class-specific deltasSoftmax across 91 slotsDrop background slot 0Decode against proposalsBox coder weights 10,10,5,5; clip to canvasScore > 0.05; remove tiny boxes; class NMS 0.5; top 100N ≤100 boxes, labels and scores; invert input resizeR and N are dynamic. Their upper limits are fixed:R ≤1000 and N ≤100. All per-RoI dimensions are resolved.Model outputs use 91-class IDs; the library maps valid COCO IDs to 80.Flatten spatial features12544 values; skip for second FCLinear1024 output features; bias=TrueReLUFully connected unitProjection bottleneckStage order: C2 / C3 / C4 / C5.Input64 / 256 / 512 / 1024 chConv2d 1×164 / 128 / 256 / 512 output channelsFrozenBatchNorm2d64 / 128 / 256 / 512 channelsReLUConv2d 3×3, p=1s=1/2/2/2FrozenBatchNorm2d64 / 128 / 256 / 512 channelsReLUConv2d 1×1256 / 512 / 1024 / 2048 output channelsFrozenBatchNorm2dNo activation before addition+ReLUBlock outputConv2d 1×1256 / 512 / 1024 / 2048 chFrozenBatchNorm2dStride 1 / 2 / 2 / 2Identity bottleneckStage order: C2 / C3 / C4 / C5.Input256 / 512 / 1024 / 2048 chConv2d 1×164 / 128 / 256 / 512 output channelsFrozenBatchNorm2d64 / 128 / 256 / 512 channelsReLUConv2d 3×3, p=1s=1FrozenBatchNorm2d64 / 128 / 256 / 512 channelsReLUConv2d 1×1256 / 512 / 1024 / 2048 output channelsFrozenBatchNorm2dNo activation before addition+ReLUBlock outputidentityNormalization and RoIAlignFrozenBatchNorm2deps=0; stored statistics in evalReLU or HardswishHardswish(x) = x × clamp(x + 3, 0, 6) / 6RPN repeated unit (no normalization)Conv2d 3×3, p=1256 channels; bias=TrueReLUPreserve spatial dimensionsChoose a feature level per proposalfloor(4 + log2(sqrt(box area) / 224)); clip level rangeRoIAlign: scale box to feature coordinatesAligned=False; bilinear samples; sampling_ratio=2Average 2 × 2 samples in every bin7 × 7 bins for boxes; 14 × 14 bins for masksR is proposal count and N is final detection count.These dimensions depend on image values, even at fixed input size.ResNet box/mask RoIAlign selects among P2...P5.Complete native inference path with random-weight CPU validation. Data-dependent selection counts are not fixed tensor dimensions.Source: models/faster_rcnn/nn.py; models/faster_rcnn/nn.py. Revision a4d0ecc9e17f.libreyolo.com