basecls.models.mbnet#
MobileNet Series
MobileNetV1: “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications”
MobileNetV2: “MobileNetV2: Inverted Residuals and Linear Bottlenecks”
MobileNetV3: “Searching for MobileNetV3”
引用
rwightman/pytorch-image-models rwightman/pytorch-image-models
- class basecls.models.mbnet.MBConv(w_in, w_out, stride, kernel, exp_r, se_r, se_from_exp, se_act_name, se_approx, se_rd_fn, has_proj_act, has_skip, drop_path_prob, norm_name, act_name)[源代码]#
基类:
Module
Mobile inverted bottleneck block with SE.
Version
Expansion
DWConv
SE
PWConv
OutAct
Skip
basic
[EXP, BN, AF]
[kxk_DW, BN, AF]
[SE]
[1x1_Conv, BN]
[ AF]
[Skip]
V1
[3x3_DW, BN, ReLU6]
[1x1_Conv, BN]
[ReLU6]
V2
[EXP, BN, ReLU6]
[3x3_DW, BN, ReLU6]
[1x1_Conv, BN]
[Skip]
V3
[EXP, BN, AF]
[kxk_DW, BN, AF]
[SE]
[1x1_Conv, BN]
[Skip]
- 参数
w_in (
int
) – input width.w_out (
int
) – output width.stride (
int
) – stride of depthwise conv.kernel (
int
) – kernel of depthwise conv.exp_r (
float
) – expansion ratio.se_r (
float
) – SE ratio.se_from_exp (
bool
) – calculate SE channels from expanded (mid) channels.se_act_name (
str
) – activation function for SE.se_approx (
bool
) – whether approximated sigmoid function (HSigmoid).se_rd_fn (
Callable
) – SE round channel function.has_proj_act (
bool
) – whether apply activation to output.has_skip (
bool
) – whether apply skip connection.drop_path_prob (
float
) – drop path probability.norm_name (
str
) – normalization function.act_name (
str
) – activation function.
- class basecls.models.mbnet.MBStage(w_in, w_out, stride, depth, exp_r, drop_path_prob, **kwargs)[源代码]#
基类:
Module
MBNet stage (sequence of blocks w/ the same output shape).
- class basecls.models.mbnet.MBNet(stem_w, depths, widths, strides, kernels, exp_rs=1.0, se_rs=0.0, stage_act_names=None, has_proj_act=False, has_skip=True, drop_path_prob=0.0, width_mult=1.0, norm_name='BN', act_name='relu6', head=None)[源代码]#
基类:
Module
MobileNet model.
- 参数
stem_w (
int
) – stem width.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).exp_rs (
Union
[float
,Sequence
[Union
[float
,Sequence
[float
]]]]) – expansion ratios for MobileNet basic blocks in each stage. Default:1.0
se_rs (
Union
[float
,Sequence
[Union
[float
,Sequence
[float
]]]]) – Squeeze-and-Excitation (SE) ratios. Default:0.0
stage_act_names (
Optional
[Sequence
[str
]]) – activation function for stages. Default:None
has_proj_act (
bool
) – whether apply activation to output. Default:False
has_skip (
bool
) – whether apply skip connection. Default:True
drop_path_prob (
float
) – drop path probability. Default:0.0
width_mult (
float
) – width multiplier. Default:1.0
norm_name (
str
) – normalization function. Default:"BN"
act_name (
str
) – activation function. Default:"relu6"
head (
Optional
[Mapping
[str
,Any
]]) – head args. Default:None