conv_pool - conv pool layer classes

The file yann.layers.conv_pool.py contains the definition for the conv pool layers.

Todo

  • Need to the deconvolutional-unpooling layer.
  • Something is still not good about the convolutional batch norm layer.
class yann.layers.conv_pool.conv_pool_layer_2d(input, nkerns, input_shape, id, filter_shape=(3, 3), poolsize=(2, 2), pooltype='max', batch_norm=False, border_mode='valid', stride=(1, 1), rng=None, borrow=True, activation='relu', input_params=None, verbose=2)[source]

This class is the typical 2D convolutional pooling and batch normalizationlayer. It is called by the add_layer method in network class.

Parameters:
  • input – An input theano.tensor variable. Even theano.shared will work as long as they are in the following shape mini_batch_size, height, width, channels
  • verbose – similar to the rest of the toolbox.
  • nkerns – number of neurons in the layer
  • input_shape(mini_batch_size, channels, height, width)
  • filter_shape – (<int>,<int>)
  • pool_size – Subsample size, default is (1,1).
  • pool_type – Refer to pool for details. {‘max’, ‘sum’, ‘mean’, ‘max_same_size’}
  • batch_norm – If provided will be used, default is False.
  • border_mode – Refer to border_mode variable in yann.core.conv, module conv
  • stride – tuple (int , int). Used as convolution stride. Default (1,1)
  • rng – typically numpy.random.
  • borrowtheano borrow, typicall True.
  • activation – String, takes options that are listed in activations Needed for layers that use activations. Some activations also take support parameters, for instance maxout takes maxout type and size, softmax takes an option temperature. Refer to the module activations to know more.
  • input_params – Supply params or initializations from a pre-trained system.

Notes

Use conv_pool_layer_2d.output and conv_pool_layer_2d.output_shape from this class. L1 and L2 are also public and can also can be used for regularization. The class also has in public w, b, gamam, beta,``running_mean`` and running_var which are also a list in params, another property of this class.

print_layer(prefix=' ', nest=False, last=True)[source]

Print information about the layer

class yann.layers.conv_pool.deconv_layer_2d(input, nkerns, input_shape, id, output_shape, filter_shape=(3, 3), poolsize=(1, 1), pooltype='max', batch_norm=False, border_mode='valid', stride=(1, 1), rng=None, borrow=True, activation='relu', input_params=None, verbose=2)[source]

This class is the typical 2D convolutional pooling and batch normalizationlayer. It is called by the add_layer method in network class.

Parameters:
  • input – An input theano.tensor variable. Even theano.shared will work as long as they are in the following shape mini_batch_size, height, width, channels
  • verbose – similar to the rest of the toolbox.
  • nkerns – number of neurons in the layer
  • input_shape(mini_batch_size, channels, height, width)
  • filter_shape – (<int>,<int>)
  • pool_size – Subsample size, default is (1,1). Right now does not take a pooling.
  • pool_type – Refer to pool for details. {‘max’, ‘sum’, ‘mean’, ‘max_same_size’}
  • batch_norm – If provided will be used, default is False.
  • border_mode – Refer to border_mode variable in yann.core.conv, module conv
  • stride – tuple (int , int). Used as convolution stride. Default (1,1)
  • rng – typically numpy.random.
  • borrowtheano borrow, typicall True.
  • activation – String, takes options that are listed in activations Needed for layers that use activations. Some activations also take support parameters, for instance maxout takes maxout type and size, softmax takes an option temperature. Refer to the module activations to know more.
  • input_params – Supply params or initializations from a pre-trained system.

Notes

Use conv_pool_layer_2d.output and conv_pool_layer_2d.output_shape from this class. L1 and L2 are also public and can also can be used for regularization. The class also has in public w, b, gamam, beta,``running_mean`` and running_var which are also a list in params, another property of this class.

print_layer(prefix=' ', nest=False, last=True)[source]

Print information about the layer

class yann.layers.conv_pool.dropout_conv_pool_layer_2d(input, nkerns, input_shape, id, dropout_rate=0.5, filter_shape=(3, 3), poolsize=(2, 2), pooltype='max', batch_norm=True, border_mode='valid', stride=(1, 1), rng=None, borrow=True, activation='relu', input_params=None, verbose=2)[source]

This class is the typical 2D convolutional pooling and batch normalizationlayer. It is called by the add_layer method in network class.

Parameters:
  • input – An input theano.tensor variable. Even theano.shared will work as long as they are in the following shape mini_batch_size, height, width, channels
  • verbose – similar to the rest of the toolbox.
  • nkerns – number of neurons in the layer
  • input_shape(mini_batch_size, channels, height, width)
  • filter_shape – (<int>,<int>)
  • pool_size – Subsample size, default is (1,1).
  • pool_type – Refer to pool for details. {‘max’, ‘sum’, ‘mean’, ‘max_same_size’}
  • batch_norm – If provided will be used, default is False.
  • border_mode – Refer to border_mode variable in yann.core.conv, module conv
  • stride – tuple (int , int). Used as convolution stride. Default (1,1)
  • rng – typically numpy.random.
  • borrowtheano borrow, typicall True.
  • activation – String, takes options that are listed in activations Needed for layers that use activations. Some activations also take support parameters, for instance maxout takes maxout type and size, softmax takes an option temperature. Refer to the module activations to know more.
  • input_params – Supply params or initializations from a pre-trained system.

Notes

Use conv_pool_layer_2d.output and conv_pool_layer_2d.output_shape from this class. L1 and L2 are also public and can also can be used for regularization. The class also has in public w, b and alpha which are also a list in params, another property of this class.

class yann.layers.conv_pool.dropout_deconv_layer_2d(input, nkerns, input_shape, id, output_shape, dropout_rate=0.5, filter_shape=(3, 3), poolsize=(1, 1), pooltype='max', batch_norm=True, border_mode='valid', stride=(1, 1), rng=None, borrow=True, activation='relu', input_params=None, verbose=2)[source]

This class is the typical 2D deconvolutional and batch normalization layer. It is called by the add_layer method in network class.

Parameters:
  • input – An input theano.tensor variable. Even theano.shared will work as long as they are in the following shape mini_batch_size, height, width, channels
  • verbose – similar to the rest of the toolbox.
  • nkerns – number of neurons in the layer
  • input_shape(mini_batch_size, channels, height, width)
  • filter_shape – (<int>,<int>)
  • pool_size – Subsample size, default is (1,1).
  • pool_type – Refer to pool for details. {‘max’, ‘sum’, ‘mean’, ‘max_same_size’}
  • batch_norm – If provided will be used, default is False.
  • border_mode – Refer to border_mode variable in yann.core.conv, module conv
  • stride – tuple (int , int). Used as convolution stride. Default (1,1)
  • rng – typically numpy.random.
  • borrowtheano borrow, typicall True.
  • activation – String, takes options that are listed in activations Needed for layers that use activations. Some activations also take support parameters, for instance maxout takes maxout type and size, softmax takes an option temperature. Refer to the module activations to know more.
  • input_params – Supply params or initializations from a pre-trained system.

Notes

Use conv_pool_layer_2d.output and conv_pool_layer_2d.output_shape from this class. L1 and L2 are also public and can also can be used for regularization. The class also has in public w, b and alpha which are also a list in params, another property of this class.