public depthwise_sep_conv_bn — function
depthwise_sep_conv_bn(kernelsize, inplanes, outplanes, activation = relu;
rev = false, use_bn = (true, true),
stride = 1, pad = 0, dilation = 1, [bias, weight, init],
initβ = Flux.zeros32, initγ = Flux.ones32,
ϵ = 1.0f-5, momentum = 1.0f-1)
Create a depthwise separable convolution chain as used in MobileNetv1. This is sequence of layers:
- a
kernelsizedepthwise convolution frominplanes => inplanes - a batch norm layer +
activation(ifuse_bn[1] == true; otherwiseactivationis applied to the convolution output) - a
kernelsizeconvolution frominplanes => outplanes - a batch norm layer +
activation(ifuse_bn[2] == true; otherwiseactivationis applied to the convolution output)
See Fig. 3 in reference.
Arguments
kernelsize: size of the convolution kernel (tuple)inplanes: number of input feature mapsoutplanes: number of output feature mapsactivation: the activation function for the final layerrev: set totrueto place the batch norm before the convolutionuse_bn: a tuple of two booleans to specify whether to use batch normalization for the first and second convolutionstride: stride of the first convolution kernelpad: padding of the first convolution kerneldilation: dilation of the first convolution kernelbias,weight,init: initialization for the convolution kernel (seeFlux.Conv)initβ,initγ: initialization for the batch norm (seeFlux.BatchNorm)ϵ,momentum: batch norm parameters (seeFlux.BatchNorm)