fovi.arch.convnextv2

class fovi.arch.convnextv2.LayerNorm(normalized_shape, eps=1e-6, data_format='channels_last')[source]

Bases: Module

LayerNorm that supports two data formats: channels_last (default) or channels_first. The ordering of the dimensions in the inputs. channels_last corresponds to inputs with shape (batch_size, height, width, channels) while channels_first corresponds to inputs with shape (batch_size, channels, height, width).

__init__(normalized_shape, eps=1e-6, data_format='channels_last')[source]

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

forward(x)[source]

Define 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 fovi.arch.convnextv2.GRN(dim)[source]

Bases: Module

GRN (Global Response Normalization) layer

__init__(dim)[source]

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

forward(x)[source]

Define 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 fovi.arch.convnextv2.Block(dim, drop_path=0.)[source]

Bases: Module

ConvNeXtV2 Block.

Parameters:
  • dim (int) – Number of input channels.

  • drop_path (float) – Stochastic depth rate. Default: 0.0

__init__(dim, drop_path=0.)[source]

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

forward(x)[source]

Define 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 fovi.arch.convnextv2.ConvNeXtV2(in_chans=3, num_classes=1000, depths=[3, 3, 9, 3], dims=[96, 192, 384, 768], drop_path_rate=0., head_init_scale=1.)[source]

Bases: Module

ConvNeXt V2

Parameters:
  • in_chans (int) – Number of input image channels. Default: 3

  • num_classes (int) – Number of classes for classification head. Default: 1000

  • depths (tuple(int)) – Number of blocks at each stage. Default: [3, 3, 9, 3]

  • dims (int) – Feature dimension at each stage. Default: [96, 192, 384, 768]

  • drop_path_rate (float) – Stochastic depth rate. Default: 0.

  • head_init_scale (float) – Init scaling value for classifier weights and biases. Default: 1.

__init__(in_chans=3, num_classes=1000, depths=[3, 3, 9, 3], dims=[96, 192, 384, 768], drop_path_rate=0., head_init_scale=1.)[source]

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

forward_features(x)[source]
forward(x)[source]

Define 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.

fovi.arch.convnextv2.convnextv2_atto(**kwargs)[source]
fovi.arch.convnextv2.convnextv2_femto(**kwargs)[source]
fovi.arch.convnextv2.convnext_pico(**kwargs)[source]
fovi.arch.convnextv2.convnextv2_nano(**kwargs)[source]
fovi.arch.convnextv2.convnextv2_tiny(**kwargs)[source]
fovi.arch.convnextv2.convnextv2_base(**kwargs)[source]
fovi.arch.convnextv2.convnextv2_large(**kwargs)[source]
fovi.arch.convnextv2.convnextv2_huge(**kwargs)[source]