diff --git a/mobilenet_v3_large_1.0.prototxt b/mobilenet_v3_large_1.0.prototxt index b9a0f89..30af007 100644 --- a/mobilenet_v3_large_1.0.prototxt +++ b/mobilenet_v3_large_1.0.prototxt @@ -549,12 +549,6 @@ layer { bias_term: true } } -layer { - name: "conv3-2/dwise-relu" - type: "ReLU6" - bottom: "conv3-2/dwise" - top: "conv3-2/dwise" -} # se layer { @@ -660,6 +654,12 @@ layer { axis: 0 } } +layer { + name: "conv3-2/dwise/scale-relu" + type: "ReLU6" + bottom: "conv3-2/dwise/scale" + top: "conv3-2/dwise/scale" +} layer { name: "conv3-2/linear" @@ -778,12 +778,6 @@ layer { bias_term: true } } -layer { - name: "conv4-1/dwise-relu" - type: "ReLU6" - bottom: "conv4-1/dwise" - top: "conv4-1/dwise" -} # se layer { @@ -889,6 +883,12 @@ layer { axis: 0 } } +layer { + name: "conv4-1/dwise/scale-relu" + type: "ReLU6" + bottom: "conv4-1/dwise/scale" + top: "conv4-1/dwise/scale" +} layer { name: "conv4-1/linear" @@ -1015,12 +1015,6 @@ layer { bias_term: true } } -layer { - name: "conv4-2/dwise-relu" - type: "ReLU6" - bottom: "conv4-2/dwise" - top: "conv4-2/dwise" -} # se layer { @@ -1126,6 +1120,12 @@ layer { axis: 0 } } +layer { + name: "conv4-2/dwise/scale-relu" + type: "ReLU6" + bottom: "conv4-2/dwise/scale" + top: "conv4-2/dwise/scale" +} layer { name: "conv4-2/linear" @@ -2069,51 +2069,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv5-4/dwise/shift" - type: "Power" - bottom: "conv5-4/dwise" - top: "conv5-4/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv5-4/dwise/shift-relu" - type: "ReLU6" - bottom: "conv5-4/dwise/shift" - top: "conv5-4/dwise/shift" -} -layer { - name: "conv5-4/dwise/shift-div" - type: "Power" - bottom: "conv5-4/dwise/shift" - top: "conv5-4/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv5-4/dwise/hswish" - type: "Eltwise" - bottom: "conv5-4/dwise" - bottom: "conv5-4/dwise/shift-div" - top: "conv5-4/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv5-4/dwise-se-pool" type: "Pooling" - bottom: "conv5-4/dwise/hswish" + bottom: "conv5-4/dwise" top: "conv5-4/dwise-se-pool" pooling_param { pool: AVE @@ -2206,18 +2167,57 @@ layer { layer { name: "conv5-4/dwise/scale" type: "Scale" - bottom: "conv5-4/dwise/hswish" + bottom: "conv5-4/dwise" bottom: "conv5-4/dwise-se-fc2/shift-div" top: "conv5-4/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv5-4/dwise/shift" + type: "Power" + bottom: "conv5-4/dwise/scale" + top: "conv5-4/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv5-4/dwise/shift-relu" + type: "ReLU6" + bottom: "conv5-4/dwise/shift" + top: "conv5-4/dwise/shift" +} +layer { + name: "conv5-4/dwise/shift-div" + type: "Power" + bottom: "conv5-4/dwise/shift" + top: "conv5-4/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv5-4/dwise/scale/hswish" + type: "Eltwise" + bottom: "conv5-4/dwise/scale" + bottom: "conv5-4/dwise/shift-div" + top: "conv5-4/dwise/scale/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv5-4/linear" type: "Convolution" - bottom: "conv5-4/dwise/scale" + bottom: "conv5-4/dwise/scale/hswish" top: "conv5-4/linear" param { lr_mult: 1 @@ -2364,51 +2364,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv5-5/dwise/shift" - type: "Power" - bottom: "conv5-5/dwise" - top: "conv5-5/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv5-5/dwise/shift-relu" - type: "ReLU6" - bottom: "conv5-5/dwise/shift" - top: "conv5-5/dwise/shift" -} -layer { - name: "conv5-5/dwise/shift-div" - type: "Power" - bottom: "conv5-5/dwise/shift" - top: "conv5-5/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv5-5/dwise/hswish" - type: "Eltwise" - bottom: "conv5-5/dwise" - bottom: "conv5-5/dwise/shift-div" - top: "conv5-5/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv5-5/dwise-se-pool" type: "Pooling" - bottom: "conv5-5/dwise/hswish" + bottom: "conv5-5/dwise" top: "conv5-5/dwise-se-pool" pooling_param { pool: AVE @@ -2501,18 +2462,57 @@ layer { layer { name: "conv5-5/dwise/scale" type: "Scale" - bottom: "conv5-5/dwise/hswish" + bottom: "conv5-5/dwise" bottom: "conv5-5/dwise-se-fc2/shift-div" top: "conv5-5/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv5-5/dwise/shift" + type: "Power" + bottom: "conv5-5/dwise/scale" + top: "conv5-5/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv5-5/dwise/shift-relu" + type: "ReLU6" + bottom: "conv5-5/dwise/shift" + top: "conv5-5/dwise/shift" +} +layer { + name: "conv5-5/dwise/shift-div" + type: "Power" + bottom: "conv5-5/dwise/shift" + top: "conv5-5/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv5-5/dwise/hswish" + type: "Eltwise" + bottom: "conv5-5/dwise/scale" + bottom: "conv5-5/dwise/shift-div" + top: "conv5-5/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv5-5/linear" type: "Convolution" - bottom: "conv5-5/dwise/scale" + bottom: "conv5-5/dwise/hswish" top: "conv5-5/linear" param { lr_mult: 1 @@ -2667,51 +2667,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv5-6/dwise/shift" - type: "Power" - bottom: "conv5-6/dwise" - top: "conv5-6/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv5-6/dwise/shift-relu" - type: "ReLU6" - bottom: "conv5-6/dwise/shift" - top: "conv5-6/dwise/shift" -} -layer { - name: "conv5-6/dwise/shift-div" - type: "Power" - bottom: "conv5-6/dwise/shift" - top: "conv5-6/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv5-6/dwise/hswish" - type: "Eltwise" - bottom: "conv5-6/dwise" - bottom: "conv5-6/dwise/shift-div" - top: "conv5-6/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv5-6/dwise-se-pool" type: "Pooling" - bottom: "conv5-6/dwise/hswish" + bottom: "conv5-6/dwise" top: "conv5-6/dwise-se-pool" pooling_param { pool: AVE @@ -2804,18 +2765,57 @@ layer { layer { name: "conv5-6/dwise/scale" type: "Scale" - bottom: "conv5-6/dwise/hswish" + bottom: "conv5-6/dwise" bottom: "conv5-6/dwise-se-fc2/shift-div" top: "conv5-6/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv5-6/dwise/shift" + type: "Power" + bottom: "conv5-6/dwise/scale" + top: "conv5-6/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv5-6/dwise/shift-relu" + type: "ReLU6" + bottom: "conv5-6/dwise/shift" + top: "conv5-6/dwise/shift" +} +layer { + name: "conv5-6/dwise/shift-div" + type: "Power" + bottom: "conv5-6/dwise/shift" + top: "conv5-6/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv5-6/dwise/hswish" + type: "Eltwise" + bottom: "conv5-6/dwise/scale" + bottom: "conv5-6/dwise/shift-div" + top: "conv5-6/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv5-6/linear" type: "Convolution" - bottom: "conv5-6/dwise/scale" + bottom: "conv5-6/dwise/hswish" top: "conv5-6/linear" param { lr_mult: 1 @@ -2970,51 +2970,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv5-7/dwise/shift" - type: "Power" - bottom: "conv5-7/dwise" - top: "conv5-7/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv5-7/dwise/shift-relu" - type: "ReLU6" - bottom: "conv5-7/dwise/shift" - top: "conv5-7/dwise/shift" -} -layer { - name: "conv5-7/dwise/shift-div" - type: "Power" - bottom: "conv5-7/dwise/shift" - top: "conv5-7/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv5-7/dwise/hswish" - type: "Eltwise" - bottom: "conv5-7/dwise" - bottom: "conv5-7/dwise/shift-div" - top: "conv5-7/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv5-7/dwise-se-pool" type: "Pooling" - bottom: "conv5-7/dwise/hswish" + bottom: "conv5-7/dwise" top: "conv5-7/dwise-se-pool" pooling_param { pool: AVE @@ -3107,18 +3068,57 @@ layer { layer { name: "conv5-7/dwise/scale" type: "Scale" - bottom: "conv5-7/dwise/hswish" + bottom: "conv5-7/dwise" bottom: "conv5-7/dwise-se-fc2/shift-div" top: "conv5-7/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv5-7/dwise/shift" + type: "Power" + bottom: "conv5-7/dwise/scale" + top: "conv5-7/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv5-7/dwise/shift-relu" + type: "ReLU6" + bottom: "conv5-7/dwise/shift" + top: "conv5-7/dwise/shift" +} +layer { + name: "conv5-7/dwise/shift-div" + type: "Power" + bottom: "conv5-7/dwise/shift" + top: "conv5-7/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv5-7/dwise/hswish" + type: "Eltwise" + bottom: "conv5-7/dwise/scale" + bottom: "conv5-7/dwise/shift-div" + top: "conv5-7/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv5-7/linear" type: "Convolution" - bottom: "conv5-7/dwise/scale" + bottom: "conv5-7/dwise/hswish" top: "conv5-7/linear" param { lr_mult: 1 @@ -3265,51 +3265,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv6-1/dwise/shift" - type: "Power" - bottom: "conv6-1/dwise" - top: "conv6-1/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv6-1/dwise/shift-relu" - type: "ReLU6" - bottom: "conv6-1/dwise/shift" - top: "conv6-1/dwise/shift" -} -layer { - name: "conv6-1/dwise/shift-div" - type: "Power" - bottom: "conv6-1/dwise/shift" - top: "conv6-1/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv6-1/dwise/hswish" - type: "Eltwise" - bottom: "conv6-1/dwise" - bottom: "conv6-1/dwise/shift-div" - top: "conv6-1/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv6-1/dwise-se-pool" type: "Pooling" - bottom: "conv6-1/dwise/hswish" + bottom: "conv6-1/dwise" top: "conv6-1/dwise-se-pool" pooling_param { pool: AVE @@ -3402,18 +3363,57 @@ layer { layer { name: "conv6-1/dwise/scale" type: "Scale" - bottom: "conv6-1/dwise/hswish" + bottom: "conv6-1/dwise" bottom: "conv6-1/dwise-se-fc2/shift-div" top: "conv6-1/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv6-1/dwise/shift" + type: "Power" + bottom: "conv6-1/dwise/scale" + top: "conv6-1/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv6-1/dwise/shift-relu" + type: "ReLU6" + bottom: "conv6-1/dwise/shift" + top: "conv6-1/dwise/shift" +} +layer { + name: "conv6-1/dwise/shift-div" + type: "Power" + bottom: "conv6-1/dwise/shift" + top: "conv6-1/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv6-1/dwise/hswish" + type: "Eltwise" + bottom: "conv6-1/dwise/scale" + bottom: "conv6-1/dwise/shift-div" + top: "conv6-1/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv6-1/linear" type: "Convolution" - bottom: "conv6-1/dwise/scale" + bottom: "conv6-1/dwise/hswish" top: "conv6-1/linear" param { lr_mult: 1 @@ -3591,15 +3591,22 @@ layer { lr_mult: 1 decay_mult: 1 } + param { + lr_mult: 2 + decay_mult: 0 + } convolution_param { num_output: 1280 pad: 0 - bias_term: false kernel_size: 1 stride: 1 weight_filler { type: "msra" } + bias_filler { + type: "constant" + value: 0 + } } } # H-swish @@ -3652,15 +3659,22 @@ layer { lr_mult: 1 decay_mult: 1 } + param { + lr_mult: 2 + decay_mult: 0 + } convolution_param { num_output: 1000 pad: 0 - bias_term: false kernel_size: 1 stride: 1 weight_filler { type: "msra" } + bias_filler { + type: "constant" + value: 0 + } } } diff --git a/mobilenet_v3_small_1.0.prototxt b/mobilenet_v3_small_1.0.prototxt index ab57a83..e73dc2c 100644 --- a/mobilenet_v3_small_1.0.prototxt +++ b/mobilenet_v3_small_1.0.prototxt @@ -161,12 +161,6 @@ layer { bias_term: true } } -layer { - name: "conv2-1/dwise-relu" - type: "ReLU6" - bottom: "conv2-1/dwise" - top: "conv2-1/dwise" -} # se layer { @@ -272,6 +266,12 @@ layer { axis: 0 } } +layer { + name: "conv2-1/dwise/scale-relu" + type: "ReLU6" + bottom: "conv2-1/dwise/scale" + top: "conv2-1/dwise/scale" +} layer { name: "conv2-1/linear" @@ -679,51 +679,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv4-2/dwise/shift" - type: "Power" - bottom: "conv4-2/dwise" - top: "conv4-2/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv4-2/dwise/shift-relu" - type: "ReLU6" - bottom: "conv4-2/dwise/shift" - top: "conv4-2/dwise/shift" -} -layer { - name: "conv4-2/dwise/shift-div" - type: "Power" - bottom: "conv4-2/dwise/shift" - top: "conv4-2/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv4-2/dwise/hswish" - type: "Eltwise" - bottom: "conv4-2/dwise" - bottom: "conv4-2/dwise/shift-div" - top: "conv4-2/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv4-2/dwise-se-pool" type: "Pooling" - bottom: "conv4-2/dwise/hswish" + bottom: "conv4-2/dwise" top: "conv4-2/dwise-se-pool" pooling_param { pool: AVE @@ -816,18 +777,57 @@ layer { layer { name: "conv4-2/dwise/scale" type: "Scale" - bottom: "conv4-2/dwise/hswish" + bottom: "conv4-2/dwise" bottom: "conv4-2/dwise-se-fc2/shift-div" top: "conv4-2/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv4-2/dwise/shift" + type: "Power" + bottom: "conv4-2/dwise/scale" + top: "conv4-2/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv4-2/dwise/shift-relu" + type: "ReLU6" + bottom: "conv4-2/dwise/shift" + top: "conv4-2/dwise/shift" +} +layer { + name: "conv4-2/dwise/shift-div" + type: "Power" + bottom: "conv4-2/dwise/shift" + top: "conv4-2/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv4-2/dwise/hswish" + type: "Eltwise" + bottom: "conv4-2/dwise/scale" + bottom: "conv4-2/dwise/shift-div" + top: "conv4-2/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv4-2/linear" type: "Convolution" - bottom: "conv4-2/dwise/scale" + bottom: "conv4-2/dwise/hswish" top: "conv4-2/linear" param { lr_mult: 1 @@ -974,51 +974,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv5-1/dwise/shift" - type: "Power" - bottom: "conv5-1/dwise" - top: "conv5-1/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv5-1/dwise/shift-relu" - type: "ReLU6" - bottom: "conv5-1/dwise/shift" - top: "conv5-1/dwise/shift" -} -layer { - name: "conv5-1/dwise/shift-div" - type: "Power" - bottom: "conv5-1/dwise/shift" - top: "conv5-1/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv5-1/dwise/hswish" - type: "Eltwise" - bottom: "conv5-1/dwise" - bottom: "conv5-1/dwise/shift-div" - top: "conv5-1/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv5-1/dwise-se-pool" type: "Pooling" - bottom: "conv5-1/dwise/hswish" + bottom: "conv5-1/dwise" top: "conv5-1/dwise-se-pool" pooling_param { pool: AVE @@ -1111,18 +1072,57 @@ layer { layer { name: "conv5-1/dwise/scale" type: "Scale" - bottom: "conv5-1/dwise/hswish" + bottom: "conv5-1/dwise" bottom: "conv5-1/dwise-se-fc2/shift-div" top: "conv5-1/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv5-1/dwise/shift" + type: "Power" + bottom: "conv5-1/dwise/scale" + top: "conv5-1/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv5-1/dwise/shift-relu" + type: "ReLU6" + bottom: "conv5-1/dwise/shift" + top: "conv5-1/dwise/shift" +} +layer { + name: "conv5-1/dwise/shift-div" + type: "Power" + bottom: "conv5-1/dwise/shift" + top: "conv5-1/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv5-1/dwise/hswish" + type: "Eltwise" + bottom: "conv5-1/dwise/scale" + bottom: "conv5-1/dwise/shift-div" + top: "conv5-1/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv5-1/linear" type: "Convolution" - bottom: "conv5-1/dwise/scale" + bottom: "conv5-1/dwise/hswish" top: "conv5-1/linear" param { lr_mult: 1 @@ -1277,51 +1277,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv5-2/dwise/shift" - type: "Power" - bottom: "conv5-2/dwise" - top: "conv5-2/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv5-2/dwise/shift-relu" - type: "ReLU6" - bottom: "conv5-2/dwise/shift" - top: "conv5-2/dwise/shift" -} -layer { - name: "conv5-2/dwise/shift-div" - type: "Power" - bottom: "conv5-2/dwise/shift" - top: "conv5-2/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv5-2/dwise/hswish" - type: "Eltwise" - bottom: "conv5-2/dwise" - bottom: "conv5-2/dwise/shift-div" - top: "conv5-2/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv5-2/dwise-se-pool" type: "Pooling" - bottom: "conv5-2/dwise/hswish" + bottom: "conv5-2/dwise" top: "conv5-2/dwise-se-pool" pooling_param { pool: AVE @@ -1414,43 +1375,82 @@ layer { layer { name: "conv5-2/dwise/scale" type: "Scale" - bottom: "conv5-2/dwise/hswish" + bottom: "conv5-2/dwise" bottom: "conv5-2/dwise-se-fc2/shift-div" top: "conv5-2/dwise/scale" scale_param{ axis: 0 } } - +# H-swish layer { - name: "conv5-2/linear" - type: "Convolution" + name: "conv5-2/dwise/shift" + type: "Power" bottom: "conv5-2/dwise/scale" - top: "conv5-2/linear" - param { - lr_mult: 1 - decay_mult: 1 - } - convolution_param { - num_output: 40 - pad: 0 - bias_term: false - kernel_size: 1 - stride: 1 - weight_filler { - type: "msra" - } + top: "conv5-2/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 } } layer { - name: "conv5-2/linear-bn" - type: "BatchNorm" - bottom: "conv5-2/linear" - top: "conv5-2/linear" + name: "conv5-2/dwise/shift-relu" + type: "ReLU6" + bottom: "conv5-2/dwise/shift" + top: "conv5-2/dwise/shift" } layer { - name: "conv5-2/linear-bn-scale" - type: "Scale" + name: "conv5-2/dwise/shift-div" + type: "Power" + bottom: "conv5-2/dwise/shift" + top: "conv5-2/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv5-2/dwise/hswish" + type: "Eltwise" + bottom: "conv5-2/dwise/scale" + bottom: "conv5-2/dwise/shift-div" + top: "conv5-2/dwise/hswish" + eltwise_param { + operation: PROD + } +} + +layer { + name: "conv5-2/linear" + type: "Convolution" + bottom: "conv5-2/dwise/hswish" + top: "conv5-2/linear" + param { + lr_mult: 1 + decay_mult: 1 + } + convolution_param { + num_output: 40 + pad: 0 + bias_term: false + kernel_size: 1 + stride: 1 + weight_filler { + type: "msra" + } + } +} +layer { + name: "conv5-2/linear-bn" + type: "BatchNorm" + bottom: "conv5-2/linear" + top: "conv5-2/linear" +} +layer { + name: "conv5-2/linear-bn-scale" + type: "Scale" bottom: "conv5-2/linear" top: "conv5-2/linear" scale_param { @@ -1580,51 +1580,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv5-3/dwise/shift" - type: "Power" - bottom: "conv5-3/dwise" - top: "conv5-3/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv5-3/dwise/shift-relu" - type: "ReLU6" - bottom: "conv5-3/dwise/shift" - top: "conv5-3/dwise/shift" -} -layer { - name: "conv5-3/dwise/shift-div" - type: "Power" - bottom: "conv5-3/dwise/shift" - top: "conv5-3/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv5-3/dwise/hswish" - type: "Eltwise" - bottom: "conv5-3/dwise" - bottom: "conv5-3/dwise/shift-div" - top: "conv5-3/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv5-3/dwise-se-pool" type: "Pooling" - bottom: "conv5-3/dwise/hswish" + bottom: "conv5-3/dwise" top: "conv5-3/dwise-se-pool" pooling_param { pool: AVE @@ -1717,18 +1678,57 @@ layer { layer { name: "conv5-3/dwise/scale" type: "Scale" - bottom: "conv5-3/dwise/hswish" + bottom: "conv5-3/dwise" bottom: "conv5-3/dwise-se-fc2/shift-div" top: "conv5-3/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv5-3/dwise/shift" + type: "Power" + bottom: "conv5-3/dwise/scale" + top: "conv5-3/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv5-3/dwise/shift-relu" + type: "ReLU6" + bottom: "conv5-3/dwise/shift" + top: "conv5-3/dwise/shift" +} +layer { + name: "conv5-3/dwise/shift-div" + type: "Power" + bottom: "conv5-3/dwise/shift" + top: "conv5-3/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv5-3/dwise/hswish" + type: "Eltwise" + bottom: "conv5-3/dwise/scale" + bottom: "conv5-3/dwise/shift-div" + top: "conv5-3/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv5-3/linear" type: "Convolution" - bottom: "conv5-3/dwise/scale" + bottom: "conv5-3/dwise/hswish" top: "conv5-3/linear" param { lr_mult: 1 @@ -1875,51 +1875,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv5-4/dwise/shift" - type: "Power" - bottom: "conv5-4/dwise" - top: "conv5-4/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv5-4/dwise/shift-relu" - type: "ReLU6" - bottom: "conv5-4/dwise/shift" - top: "conv5-4/dwise/shift" -} -layer { - name: "conv5-4/dwise/shift-div" - type: "Power" - bottom: "conv5-4/dwise/shift" - top: "conv5-4/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv5-4/dwise/hswish" - type: "Eltwise" - bottom: "conv5-4/dwise" - bottom: "conv5-4/dwise/shift-div" - top: "conv5-4/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv5-4/dwise-se-pool" type: "Pooling" - bottom: "conv5-4/dwise/hswish" + bottom: "conv5-4/dwise" top: "conv5-4/dwise-se-pool" pooling_param { pool: AVE @@ -2012,18 +1973,57 @@ layer { layer { name: "conv5-4/dwise/scale" type: "Scale" - bottom: "conv5-4/dwise/hswish" + bottom: "conv5-4/dwise" bottom: "conv5-4/dwise-se-fc2/shift-div" top: "conv5-4/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv5-4/dwise/shift" + type: "Power" + bottom: "conv5-4/dwise/scale" + top: "conv5-4/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv5-4/dwise/shift-relu" + type: "ReLU6" + bottom: "conv5-4/dwise/shift" + top: "conv5-4/dwise/shift" +} +layer { + name: "conv5-4/dwise/shift-div" + type: "Power" + bottom: "conv5-4/dwise/shift" + top: "conv5-4/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv5-4/dwise/hswish" + type: "Eltwise" + bottom: "conv5-4/dwise/scale" + bottom: "conv5-4/dwise/shift-div" + top: "conv5-4/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv5-4/linear" type: "Convolution" - bottom: "conv5-4/dwise/scale" + bottom: "conv5-4/dwise/hswish" top: "conv5-4/linear" param { lr_mult: 1 @@ -2178,51 +2178,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv5-5/dwise/shift" - type: "Power" - bottom: "conv5-5/dwise" - top: "conv5-5/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv5-5/dwise/shift-relu" - type: "ReLU6" - bottom: "conv5-5/dwise/shift" - top: "conv5-5/dwise/shift" -} -layer { - name: "conv5-5/dwise/shift-div" - type: "Power" - bottom: "conv5-5/dwise/shift" - top: "conv5-5/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv5-5/dwise/hswish" - type: "Eltwise" - bottom: "conv5-5/dwise" - bottom: "conv5-5/dwise/shift-div" - top: "conv5-5/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv5-5/dwise-se-pool" type: "Pooling" - bottom: "conv5-5/dwise/hswish" + bottom: "conv5-5/dwise" top: "conv5-5/dwise-se-pool" pooling_param { pool: AVE @@ -2315,18 +2276,57 @@ layer { layer { name: "conv5-5/dwise/scale" type: "Scale" - bottom: "conv5-5/dwise/hswish" + bottom: "conv5-5/dwise" bottom: "conv5-5/dwise-se-fc2/shift-div" top: "conv5-5/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv5-5/dwise/shift" + type: "Power" + bottom: "conv5-5/dwise/scale" + top: "conv5-5/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv5-5/dwise/shift-relu" + type: "ReLU6" + bottom: "conv5-5/dwise/shift" + top: "conv5-5/dwise/shift" +} +layer { + name: "conv5-5/dwise/shift-div" + type: "Power" + bottom: "conv5-5/dwise/shift" + top: "conv5-5/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv5-5/dwise/hswish" + type: "Eltwise" + bottom: "conv5-5/dwise/scale" + bottom: "conv5-5/dwise/shift-div" + top: "conv5-5/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv5-5/linear" type: "Convolution" - bottom: "conv5-5/dwise/scale" + bottom: "conv5-5/dwise/hswish" top: "conv5-5/linear" param { lr_mult: 1 @@ -2473,51 +2473,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv6-1/dwise/shift" - type: "Power" - bottom: "conv6-1/dwise" - top: "conv6-1/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv6-1/dwise/shift-relu" - type: "ReLU6" - bottom: "conv6-1/dwise/shift" - top: "conv6-1/dwise/shift" -} -layer { - name: "conv6-1/dwise/shift-div" - type: "Power" - bottom: "conv6-1/dwise/shift" - top: "conv6-1/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv6-1/dwise/hswish" - type: "Eltwise" - bottom: "conv6-1/dwise" - bottom: "conv6-1/dwise/shift-div" - top: "conv6-1/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv6-1/dwise-se-pool" type: "Pooling" - bottom: "conv6-1/dwise/hswish" + bottom: "conv6-1/dwise" top: "conv6-1/dwise-se-pool" pooling_param { pool: AVE @@ -2610,18 +2571,57 @@ layer { layer { name: "conv6-1/dwise/scale" type: "Scale" - bottom: "conv6-1/dwise/hswish" + bottom: "conv6-1/dwise" bottom: "conv6-1/dwise-se-fc2/shift-div" top: "conv6-1/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv6-1/dwise/shift" + type: "Power" + bottom: "conv6-1/dwise/scale" + top: "conv6-1/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv6-1/dwise/shift-relu" + type: "ReLU6" + bottom: "conv6-1/dwise/shift" + top: "conv6-1/dwise/shift" +} +layer { + name: "conv6-1/dwise/shift-div" + type: "Power" + bottom: "conv6-1/dwise/shift" + top: "conv6-1/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv6-1/dwise/hswish" + type: "Eltwise" + bottom: "conv6-1/dwise/scale" + bottom: "conv6-1/dwise/shift-div" + top: "conv6-1/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv6-1/linear" type: "Convolution" - bottom: "conv6-1/dwise/scale" + bottom: "conv6-1/dwise/hswish" top: "conv6-1/linear" param { lr_mult: 1 @@ -2776,51 +2776,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv6-2/dwise/shift" - type: "Power" - bottom: "conv6-2/dwise" - top: "conv6-2/dwise/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv6-2/dwise/shift-relu" - type: "ReLU6" - bottom: "conv6-2/dwise/shift" - top: "conv6-2/dwise/shift" -} -layer { - name: "conv6-2/dwise/shift-div" - type: "Power" - bottom: "conv6-2/dwise/shift" - top: "conv6-2/dwise/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv6-2/dwise/hswish" - type: "Eltwise" - bottom: "conv6-2/dwise" - bottom: "conv6-2/dwise/shift-div" - top: "conv6-2/dwise/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv6-2/dwise-se-pool" type: "Pooling" - bottom: "conv6-2/dwise/hswish" + bottom: "conv6-2/dwise" top: "conv6-2/dwise-se-pool" pooling_param { pool: AVE @@ -2913,18 +2874,57 @@ layer { layer { name: "conv6-2/dwise/scale" type: "Scale" - bottom: "conv6-2/dwise/hswish" + bottom: "conv6-2/dwise" bottom: "conv6-2/dwise-se-fc2/shift-div" top: "conv6-2/dwise/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv6-2/dwise/shift" + type: "Power" + bottom: "conv6-2/dwise/scale" + top: "conv6-2/dwise/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv6-2/dwise/shift-relu" + type: "ReLU6" + bottom: "conv6-2/dwise/shift" + top: "conv6-2/dwise/shift" +} +layer { + name: "conv6-2/dwise/shift-div" + type: "Power" + bottom: "conv6-2/dwise/shift" + top: "conv6-2/dwise/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv6-2/dwise/hswish" + type: "Eltwise" + bottom: "conv6-2/dwise/scale" + bottom: "conv6-2/dwise/shift-div" + top: "conv6-2/dwise/hswish" + eltwise_param { + operation: PROD + } +} layer { name: "conv6-2/linear" type: "Convolution" - bottom: "conv6-2/dwise/scale" + bottom: "conv6-2/dwise/hswish" top: "conv6-2/linear" param { lr_mult: 1 @@ -3001,51 +3001,12 @@ layer { bias_term: true } } -# H-swish -layer { - name: "conv6-3/shift" - type: "Power" - bottom: "conv6-3" - top: "conv6-3/shift" - power_param { - power: 1 - scale: 1 - shift: 3 - } -} -layer { - name: "conv6-3/shift-relu" - type: "ReLU6" - bottom: "conv6-3/shift" - top: "conv6-3/shift" -} -layer { - name: "conv6-3/shift-div" - type: "Power" - bottom: "conv6-3/shift" - top: "conv6-3/shift-div" - power_param { - power: 1 - scale: 0.1666666667 - shift: 0 - } -} -layer { - name: "conv6-3/hswish" - type: "Eltwise" - bottom: "conv6-3" - bottom: "conv6-3/shift-div" - top: "conv6-3/hswish" - eltwise_param { - operation: PROD - } -} # se layer { name: "conv6-3-se-pool" type: "Pooling" - bottom: "conv6-3/hswish" + bottom: "conv6-3" top: "conv6-3-se-pool" pooling_param { pool: AVE @@ -3138,19 +3099,58 @@ layer { layer { name: "conv6-3/scale" type: "Scale" - bottom: "conv6-3/hswish" + bottom: "conv6-3" bottom: "conv6-3-se-fc2/shift-div" top: "conv6-3/scale" scale_param{ axis: 0 } } +# H-swish +layer { + name: "conv6-3/shift" + type: "Power" + bottom: "conv6-3/scale" + top: "conv6-3/shift" + power_param { + power: 1 + scale: 1 + shift: 3 + } +} +layer { + name: "conv6-3/shift-relu" + type: "ReLU6" + bottom: "conv6-3/shift" + top: "conv6-3/shift" +} +layer { + name: "conv6-3/shift-div" + type: "Power" + bottom: "conv6-3/shift" + top: "conv6-3/shift-div" + power_param { + power: 1 + scale: 0.1666666667 + shift: 0 + } +} +layer { + name: "conv6-3/hswish" + type: "Eltwise" + bottom: "conv6-3/scale" + bottom: "conv6-3/shift-div" + top: "conv6-3/hswish" + eltwise_param { + operation: PROD + } +} #################### stage 7-1 #################### layer { name: "pool7-1" type: "Pooling" - bottom: "conv6-3/scale" + bottom: "conv6-3/hswish" top: "pool7-1" pooling_param { pool: AVE