cvnets.models.detection.utils package

Submodules

cvnets.models.detection.utils.rcnn_utils module

class cvnets.models.detection.utils.rcnn_utils.FastRCNNConvFCHead(opts, input_size: Tuple[int, int, int], conv_layers: List[int], fc_layers: List[int], *args, **kwargs)[source]

Bases: Sequential

__init__(opts, input_size: Tuple[int, int, int], conv_layers: List[int], fc_layers: List[int], *args, **kwargs)[source]
Parameters:
  • input_size (Tuple[int, int, int]) – the input size in CHW format.

  • conv_layers (list) – feature dimensions of each Convolution layer

  • fc_layers (list) – feature dimensions of each FCN layer

class cvnets.models.detection.utils.rcnn_utils.RPNHead(opts, in_channels: int, num_anchors: int, conv_depth=1)[source]

Bases: Module

Adds a simple RPN Head with classification and regression heads

Parameters:
  • in_channels (int) – number of channels of the input feature

  • num_anchors (int) – number of anchors to be predicted

  • conv_depth (int, optional) – number of convolutions

__init__(opts, in_channels: int, num_anchors: int, conv_depth=1) None[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(x: List[Tensor]) Tuple[List[Tensor], List[Tensor]][source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class cvnets.models.detection.utils.rcnn_utils.MaskRCNNHeads(opts, in_channels: int, layers: List, dilation: int)[source]

Bases: Sequential

__init__(opts, in_channels: int, layers: List, dilation: int)[source]
Parameters:
  • in_channels (int) – number of input channels

  • layers (list) – feature dimensions of each FCN layer

  • dilation (int) – dilation rate of kernel

  • norm_layer (callable, optional) – Module specifying the normalization layer to use. Default: None

class cvnets.models.detection.utils.rcnn_utils.MaskRCNNPredictor(opts, in_channels: int, dim_reduced: int, num_classes: int)[source]

Bases: Sequential

__init__(opts, in_channels: int, dim_reduced: int, num_classes: int) None[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

class cvnets.models.detection.utils.rcnn_utils.FastRCNNPredictor(in_channels: int, num_classes: int)[source]

Bases: Module

Standard classification + bounding box regression layers for Fast R-CNN.

Parameters:
  • in_channels (int) – number of input channels

  • num_classes (int) – number of output classes (including background)

__init__(in_channels: int, num_classes: int) None[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(x: Tensor) Tuple[Tensor, Tensor][source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

cvnets.models.detection.utils.rcnn_utils.replace_syncbn_with_syncbnfp32(opts, num_features: int) Module[source]

Module contents