piscis.networks.efficientnetv2#

Attributes#

Classes#

EfficientNetV2

EfficientNetV2 architecture.

Functions#

round_features(→ int)

Round the number of features based on the depth multiplier.

round_repeats(→ int)

Round number of repeats based on depth multiplier.

build_efficientnetv2(→ functools.partial)

Build EfficientNetV2 architecture.

Module Contents#

piscis.networks.efficientnetv2.ModuleDef#
piscis.networks.efficientnetv2.round_features(features: int, width_coefficient: float, min_depth: int, depth_divisor: int) int#

Round the number of features based on the depth multiplier.

Parameters:
featuresint

Number of features.

width_coefficientfloat

Scaling coefficient for network width.

min_depthint

Minimum number of filters.

depth_divisorint

Unit of network width.

Returns:
new_featuresint

Rounded number of features.

piscis.networks.efficientnetv2.round_repeats(repeats: int, depth_coefficient: float) int#

Round number of repeats based on depth multiplier.

Parameters:
repeatsint

Number of repeats.

depth_coefficientfloat

Scaling coefficient for network depth.

Returns:
new_repeatsint

Rounded number of repeats.

class piscis.networks.efficientnetv2.EfficientNetV2(in_channels: int, stem_stride: int, blocks_args: Sequence, stochastic_depth_prob: float, bn_momentum: float, conv: ModuleDef = nn.Conv2d, bn: ModuleDef = nn.BatchNorm2d, act: ModuleDef = nn.SiLU)#

Bases: torch.nn.Module

EfficientNetV2 architecture.

Parameters:
in_channelsint

Number of input channels.

stem_strideint

Stride of the stem convolution.

blocks_argsSequence

List of arguments to construct block modules.

stochastic_depth_probfloat

Stochastic depth probability.

bn_momentumfloat

Momentum parameter for batch norm layers.

convModuleDef

Convolution module.

bnModuleDef

Batch norm module.

actCallable

Activation function.

stem#
blocks#
stage_sizes = []#
forward(x: torch.Tensor, capture_list: Sequence[int] | None = None) torch.Tensor | Dict[int, torch.Tensor]#
piscis.networks.efficientnetv2.build_efficientnetv2(blocks_args: Sequence[Dict[str, Any]], width_coefficient: float, depth_coefficient: float, stem_stride: int = 2, stochastic_depth_prob: float = 0.2, bn_momentum: float = 0.1, depth_divisor: int = 8, min_depth: int = 8, conv: ModuleDef = nn.Conv2d, bn: ModuleDef = nn.BatchNorm2d, act: ModuleDef = nn.SiLU) functools.partial#

Build EfficientNetV2 architecture.

Parameters:
blocks_argsSequence[Dict[str, Any]]

List of dictionaries of arguments to construct block modules.

width_coefficientfloat

Scaling coefficient for network width.

depth_coefficientfloat

Scaling coefficient for network depth.

stem_strideint, optional

Stride of the stem convolution. Default is 2.

stochastic_depth_probfloat, optional

Stochastic depth probability. Default is 0.2.

bn_momentumfloat, optional

Momentum parameter for batch norm layers. Default is 0.1.

depth_divisorint, optional

Unit of network width. Default is 8.

min_depthint, optional

Minimum number of filters. Default is 8.

convModuleDef, optional

Convolution module. Default is nn.Conv2d.

bnModuleDef, optional

Batch norm module. Default is nn.BatchNorm2d.

actModuleDef, optional

Activation function. Default is nn.SiLU.

Returns:
modelpartial

EfficientNetV2 architecture.

piscis.networks.efficientnetv2.EfficientNetV2B0#
piscis.networks.efficientnetv2.EfficientNetV2B1#
piscis.networks.efficientnetv2.EfficientNetV2B2#
piscis.networks.efficientnetv2.EfficientNetV2B3#
piscis.networks.efficientnetv2.EfficientNetV2S#
piscis.networks.efficientnetv2.EfficientNetV2M#
piscis.networks.efficientnetv2.EfficientNetV2L#