vis4d.model.detect.faster_rcnn¶
Faster RCNN model implementation and runtime.
Classes
|
Faster RCNN model. |
- class FasterRCNN(num_classes, basemodel=None, faster_rcnn_head=None, rcnn_box_decoder=None, weights=None)[source]¶
Faster RCNN model.
Creates an instance of the class.
- Parameters:
num_classes (int) – Number of object categories.
basemodel (BaseModel, optional) – Base model network. Defaults to None. If None, will use ResNet50.
faster_rcnn_head (FasterRCNNHead, optional) – Faster RCNN head. Defaults to None. if None, will use default FasterRCNNHead.
rcnn_box_decoder (DeltaXYWHBBoxDecoder, optional) – Decoder for RCNN bounding boxes. Defaults to None.
weights (str, optional) – Weights to load for model. If set to “mmdet”, will load MMDetection pre-trained weights. Defaults to None.
- __call__(images, input_hw, boxes2d=None, boxes2d_classes=None, original_hw=None)[source]¶
Type definition for call implementation.
- forward(images, input_hw, boxes2d=None, boxes2d_classes=None, original_hw=None)[source]¶
Forward pass.
- Parameters:
images (torch.Tensor) – Input images.
input_hw (list[tuple[int, int]]) – Input image resolutions.
boxes2d (None | list[torch.Tensor], optional) – Bounding box labels. Required for training. Defaults to None.
boxes2d_classes (None | list[torch.Tensor], optional) – Class labels. Required for training. Defaults to None.
original_hw (None | list[tuple[int, int]], optional) – Original image resolutions (before padding and resizing). Required for testing. Defaults to None.
- Returns:
- Either raw model outputs (for training) or
predicted outputs (for testing).
- Return type:
- forward_test(images, images_hw, original_hw)[source]¶
Forward testing stage.
- Parameters:
images (torch.Tensor) – Input images.
images_hw (list[tuple[int, int]]) – Input image resolutions.
original_hw (list[tuple[int, int]]) – Original image resolutions (before padding and resizing).
- Returns:
Predicted outputs.
- Return type:
- forward_train(images, images_hw, target_boxes, target_classes)[source]¶
Forward training stage.
- Parameters:
images (torch.Tensor) – Input images.
images_hw (list[tuple[int, int]]) – Input image resolutions.
target_boxes (list[torch.Tensor]) – Bounding box labels.
target_classes (list[torch.Tensor]) – Class labels.
- Returns:
Raw model outputs.
- Return type: