fasterrcnn
orchard.architectures.fasterrcnn
¶
Faster R-CNN Detection Architecture.
Wraps torchvision.models.detection.fasterrcnn_resnet50_fpn_v2 with
automatic head replacement for custom class counts. The +1 for the
background class is handled internally — callers pass only the number of
object categories.
build_fasterrcnn(num_classes, pretrained=True)
¶
Build a Faster R-CNN with ResNet-50-FPN v2 backbone.
Loads the torchvision pre-built model and replaces the box predictor
head to match the target number of classes. Background is added
automatically (num_classes + 1).
Unlike classification builders, this does not accept in_channels
because Faster R-CNN always uses RGB (3-channel) input internally.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_classes
|
int
|
Number of object categories (excluding background). |
required |
pretrained
|
bool
|
If True, load COCO-pretrained weights for the backbone. |
True
|
Returns:
| Type | Description |
|---|---|
Module
|
Faster R-CNN model with custom class head (device placement handled by factory). |