basecls.models.snet#

Shufflenet Series

ShufflenetV2: “ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design”

引用

megvii-model/ShuffleNet-Series

class basecls.models.snet.SNV2Block(w_in, w_out, w_mid, *, kernel, stride, norm_name, act_name, se_r, drop_path_prob, **kwargs)[源代码]#

基类:Module

ShuffleNet V2 Block

forward(old_x)[源代码]#
class basecls.models.snet.SNV2XceptionBlock(w_in, w_out, w_mid, *, kernel, stride, norm_name, act_name, se_r, drop_path_prob, **kwargs)[源代码]#

基类:SNV2Block

ShuffleNet V2 Xception stype block used in ShuffleNet V2+

class basecls.models.snet.SNetV2(block, stem_w, depths, widths, strides, kernels, use_maxpool=True, se_r=0.0, drop_path_prob=0.0, norm_name='BN', act_name='relu', head=None)[源代码]#

基类:Module

ShufflenetV2 model.

参数
  • block (Callable) – building block to use, SNV2XceptionBlock for v2+.

  • stem_w (int) – width for stem layer.

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

  • use_maxpool (bool) – whether use maxpool stride 2 after stem. Default: True

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

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

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

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

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

forward(x)[源代码]#