cvnets.anchor_generator package

Submodules

cvnets.anchor_generator.base_anchor_generator module

class cvnets.anchor_generator.base_anchor_generator.BaseAnchorGenerator(*args, **kwargs)[source]

Bases: Module

Base class for anchor generators for the task of object detection.

__init__(*args, **kwargs) None[source]

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

classmethod add_arguments(parser: ArgumentParser) ArgumentParser[source]

Add anchor generator-specific arguments to the parser

num_anchors_per_os()[source]

Returns anchors per output stride. Child classes must implement this function.

forward(fm_height: int, fm_width: int, fm_output_stride: int, device: str | None = 'cpu', *args, **kwargs) Tensor | Tuple[Tensor, ...][source]

Returns anchors for the feature map

Parameters:
  • fm_height (int) – Height of the feature map

  • fm_width (int) – Width of the feature map

  • fm_output_stride (int) – Output stride of the feature map

  • device (Optional, str) – Device (cpu or cuda). Defaults to cpu

Returns:

Tensor or Tuple of Tensors

cvnets.anchor_generator.ssd_anchor_generator module

class cvnets.anchor_generator.ssd_anchor_generator.SSDAnchorGenerator(opts, *args, **kwargs)[source]

Bases: BaseAnchorGenerator

This class generates anchors (or priors) on-the-fly for the single shot object detector (SSD).

__init__(opts, *args, **kwargs) None[source]

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

classmethod add_arguments(parser: ArgumentParser) ArgumentParser[source]

Adds SSD anchor generator-specific arguments to the parser

num_anchors_per_os() List[source]

Returns anchors per output stride for SSD

Module contents

cvnets.anchor_generator.arguments_anchor_gen(parser: ArgumentParser) ArgumentParser[source]

Arguments related to anchor generator for object detection

cvnets.anchor_generator.build_anchor_generator(opts, *args, **kwargs)[source]

Build anchor generator for object detection