basecls.models.effnet#

EfficientNet Series

EfficientNet: “EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks”

引用

facebookresearch/pycls rwightman/pytorch-image-models rwightman/pytorch-image-models

class basecls.models.effnet.FuseMBConv(w_in, w_out, stride, kernel, exp_r, se_r, has_skip, drop_path_prob, norm_name, act_name, **kwargs)[源代码]#

基类:Module

Fusing the proj conv1x1 and depthwise conv into a conv2d.

参数
  • w_in (int) – input width.

  • w_out (int) – output width.

  • stride (int) – stride of conv.

  • kernel (int) – kernel of conv.

  • exp_r (float) – expansion ratio.

  • se_r (float) – SE ratio.

  • has_skip (bool) – whether apply skip connection.

  • drop_path_prob (float) – drop path probability.

  • norm_name (str) – normalization function.

  • act_name (str) – activation function.

forward(x)[源代码]#
class basecls.models.effnet.EffNet(stem_w, block_name, depths, widths, strides, kernels, exp_rs=1.0, se_rs=0.0, drop_path_prob=0.0, depth_mult=1.0, width_mult=1.0, omit_mult=False, norm_name='BN', act_name='silu', head=None)[源代码]#

基类:Module

EfficientNet model.

参数
  • stem_w (int) – stem width.

  • block_name (Union[str, Callable, Sequence[Union[str, Callable]]]) – block name.

  • depths (Sequence[int]) – depth for each stage (number of blocks in the stage).

  • widths (Sequence[int]) – width for each stage (width of each block in the stage).

  • strides (Sequence[int]) – strides for each stage (applies to the first block of each stage).

  • kernels (Sequence[int]) – kernel sizes for each stage.

  • exp_rs (Union[float, Sequence[Union[float, Sequence[float]]]]) – expansion ratios for MBConv blocks in each stage.

  • se_r – Squeeze-and-Excitation (SE) ratio. Default: 0.25

  • drop_path_prob (float) – drop path probability. Default: 0.0

  • depth_mult (float) – depth multiplier. Default: 1.0

  • width_mult (float) – width multiplier. Default: 1.0

  • omit_mult (bool) – omit multiplier for stem width, head width, the first stage depth and the last stage depth, enabled in EfficientNet-Lite. Default: False

  • norm_name (str) – normalization function. Default: "BN"

  • act_name (str) – activation function. Default: "silu"

  • head (Optional[Mapping[str, Any]]) – head args. Default: None

forward(x)[源代码]#
static get_block_func(name)[源代码]#

Retrieves the block function by name.