clip2frame.layers

GaussianScan1DLayer(incoming, filter_size[, ...]) 1D Adaptive Gaussian filter
FixedGaussianScan1DLayer(incoming, filter_size) 1D Fixed Gaussian filter

Details

class clip2frame.layers.GaussianScan1DLayer(incoming, filter_size, init_std=5.0, W_logstd=None, stride=1, pad=0, nonlinearity=None, convolution=<function conv1d_mc0>, **kwargs)[source]

1D Adaptive Gaussian filter Gaussian filters that scan through the third dimension It is implemented with convolution.

Each element in the channel axis has its own standard deviation (sigma) for Gaussian. Gaussian filter is adjusting its sigma during training.

Performs a 1D convolution on its input

Parameters:

incoming : a Layer instance or a tuple

The layer feeding into this layer, or the expected input shape. The output of this layer should be a 3D tensor, with shape (batch_size, num_input_channels, input_length).

filter_size : int or iterable of int

An integer or a 1-element tuple specifying the size of the filters. This is the width of the filters that accomodate the Gaussian filters

init_std : float

The initial sigma for the Gaussian filters

stride : int or iterable of int

An integer or a 1-element tuple specifying the stride of the convolution operation.

pad : int, iterable of int, ‘full’, ‘same’ or ‘valid’ (default: 0)

By default, the convolution is only computed where the input and the filter fully overlap (a valid convolution). When stride=1, this yields an output that is smaller than the input by filter_size - 1. The pad argument allows you to implicitly pad the input with zeros, extending the output size.

An integer or a 1-element tuple results in symmetric zero-padding of the given size on both borders.

'full' pads with one less than the filter size on both sides. This is equivalent to computing the convolution wherever the input and the filter overlap by at least one position.

'same' pads with half the filter size (rounded down) on both sides. When stride=1 this results in an output size equal to the input size. Even filter size is not supported.

'valid' is an alias for 0 (no padding / a valid convolution).

W_logstd : Theano shared variable, expression, numpy array or callable

Initial value, expression or initializer for the weights. These should be a 1D tensor with shape (num_input_channels, ).

Note:

The std is provided in log-scale, log(std).

convolution : callable

The convolution implementation to use. The lasagne.theano_extensions.conv module provides some alternative implementations for 1D convolutions, because the Theano API only features a 2D convolution implementation. Usually it should be fine to leave this at the default value.

**kwargs

Any additional keyword arguments are passed to the Layer superclass.

Attributes

W (Theano shared variable or expression) Variable or expression representing the filter weights.
get_W_shape()[source]

Get the shape of the weight matrix W.

Returns:

tuple of int

The shape of the weight matrix.

class clip2frame.layers.FixedGaussianScan1DLayer(incoming, filter_size, init_std=5.0, stride=1, pad=0, nonlinearity=None, convolution=<function conv1d_mc0>, **kwargs)[source]

1D Fixed Gaussian filter Gaussian filter is not changing during the training

Performs a 1D convolution on its input