basecls.layers.heads#
- basecls.layers.heads.build_head(w_in, head_args=None, norm_name='BN', act_name='relu')[源代码]#
The factory function to build head.
备注
if
head_argsisNoneorhead_args["name"]isNone, this function will do nothing and returnNone.- 参数
w_in (
int) – input width.head_args (
Optional[Mapping[str,Any]]) – head args. Default:Nonenorm_name (
str) – default normalization function, will be overridden by the same key inhead_args. Default:"BN"act_name (
str) – default activation function, will be overridden by the same key inhead_args. Default:"relu"
- 返回类型
- 返回
A head.
- class basecls.layers.heads.ClsHead(w_in, w_out=1000, width=0, dropout_prob=0.0, norm_name='BN', act_name='relu', bias=True)[源代码]#
基类:
ModuleCls head: Conv, BN, Act, AvgPool, FC.
- 参数
w_in (
int) – input width.w_out (
int) – output width, normally the number of classes. Default:1000width (
int) – width for first conv in head, conv will be omitted if set to 0. Default:0dropout_prob (
float) – dropout probability. Default:0.0norm_name (
str) – normalization function. Default:"BN"act_name (
str) – activation function. Default:"relu"bias (
bool) – whether fc has bias. Default:True
- class basecls.layers.heads.MBV3Head(w_in, w_out=1000, width=960, w_h=1280, dropout_prob=0.0, se_r=0.0, norm_name='BN', act_name='hswish', bias=True)[源代码]#
基类:
ModuleMobileNet V3 head: Conv, BN, Act, AvgPool, SE, FC, Act, FC.
- 参数
w_in (
int) – input width.w_out (
int) – output width, normally the number of classes.width (
int) – width for first conv in head.w_h (
int) – width for first linear in head.dropout_prob (
float) – dropout probability. Default:0.0se_r (
float) – Squeeze-and-Excitation (SE) ratio. Default:0.0norm_name (
str) – normalization function. Default:"BN"act_name (
str) – activation function. Default:"hswish"bias (
bool) – whether fc has bias. Default:True