2
2
mobilenetv1(width_mult, config;
3
3
activation = relu,
4
4
inchannels = 3,
5
- fcsize = 1024,
6
5
nclasses = 1000)
7
6
8
7
Create a MobileNetv1 model ([reference](https://arxiv.org/abs/1704.04861v1)).
@@ -19,14 +18,12 @@ Create a MobileNetv1 model ([reference](https://arxiv.org/abs/1704.04861v1)).
19
18
+ `s`: The stride of the convolutional kernel
20
19
+ `r`: The number of time this configuration block is repeated
21
20
- `activate`: The activation function to use throughout the network
22
- - `inchannels`: The number of input channels.
23
- - `fcsize`: The intermediate fully-connected size between the convolution and final layers
21
+ - `inchannels`: The number of input channels. The default value is 3.
24
22
- `nclasses`: The number of output classes
25
23
"""
26
24
function mobilenetv1 (width_mult, config;
27
25
activation = relu,
28
26
inchannels = 3 ,
29
- fcsize = 1024 ,
30
27
nclasses = 1000 )
31
28
layers = []
32
29
for (dw, outch, stride, nrepeats) in config
@@ -35,8 +32,7 @@ function mobilenetv1(width_mult, config;
35
32
layer = dw ?
36
33
depthwise_sep_conv_bn ((3 , 3 ), inchannels, outch, activation;
37
34
stride = stride, pad = 1 , bias = false ) :
38
- conv_norm ((3 , 3 ), inchannels, outch, activation; stride = stride,
39
- pad = 1 ,
35
+ conv_norm ((3 , 3 ), inchannels, outch, activation; stride, pad = 1 ,
40
36
bias = false )
41
37
append! (layers, layer)
42
38
inchannels = outch
@@ -46,8 +42,7 @@ function mobilenetv1(width_mult, config;
46
42
return Chain (Chain (layers),
47
43
Chain (GlobalMeanPool (),
48
44
MLUtils. flatten,
49
- Dense (inchannels, fcsize, activation),
50
- Dense (fcsize, nclasses)))
45
+ Dense (inchannels, nclasses)))
51
46
end
52
47
53
48
const mobilenetv1_configs = [
0 commit comments