Introduction

Tutorials

Developer guide

API Reference

public depthwise_sep_conv_bnfunction

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 kernelsize depthwise convolution from inplanes => inplanes
  • a batch norm layer + activation (if use_bn[1] == true; otherwise activation is applied to the convolution output)
  • a kernelsize convolution from inplanes => outplanes
  • a batch norm layer + activation (if use_bn[2] == true; otherwise activation is applied to the convolution output)

See Fig. 3 in reference.

Arguments

  • kernelsize: size of the convolution kernel (tuple)
  • inplanes: number of input feature maps
  • outplanes: number of output feature maps
  • activation: the activation function for the final layer
  • rev: set to true to place the batch norm before the convolution
  • use_bn: a tuple of two booleans to specify whether to use batch normalization for the first and second convolution
  • stride: stride of the first convolution kernel
  • pad: padding of the first convolution kernel
  • dilation: dilation of the first convolution kernel
  • bias, weight, init: initialization for the convolution kernel (see Flux.Conv)
  • initβ, initγ: initialization for the batch norm (see Flux.BatchNorm)
  • ϵ, momentum: batch norm parameters (see Flux.BatchNorm)