SHOGUN  4.1.0
所有成员列表 | Public 成员函数 | Protected 成员函数 | Protected 属性
CConvolutionalFeatureMap类 参考

详细描述

Handles convolution and gradient calculation for a single feature map in a convolutional neural network.

在文件 ConvolutionalFeatureMap.h 第 65 行定义.

Public 成员函数

 CConvolutionalFeatureMap (int32_t input_width, int32_t input_height, int32_t radius_x, int32_t radius_y, int32_t stride_x=1, int32_t stride_y=1, int32_t index=0, EConvMapActivationFunction function=CMAF_IDENTITY, ENLAutoencoderPosition autoencoder_position=NLAP_NONE)
 
void compute_activations (SGVector< float64_t > parameters, CDynamicObjectArray *layers, SGVector< int32_t > input_indices, SGMatrix< float64_t > activations)
 
void compute_gradients (SGVector< float64_t > parameters, SGMatrix< float64_t > activations, SGMatrix< float64_t > activation_gradients, CDynamicObjectArray *layers, SGVector< int32_t > input_indices, SGVector< float64_t > parameter_gradients)
 
void pool_activations (SGMatrix< float64_t > activations, int32_t pooling_width, int32_t pooling_height, SGMatrix< float64_t > pooled_activations, SGMatrix< float64_t > max_indices)
 

Protected 成员函数

void convolve (SGMatrix< float64_t > inputs, SGMatrix< float64_t > weights, SGMatrix< float64_t > outputs, bool flip, bool reset_output, int32_t inputs_row_offset, int32_t outputs_row_offset)
 
void compute_weight_gradients (SGMatrix< float64_t > inputs, SGMatrix< float64_t > local_gradients, SGMatrix< float64_t > weight_gradients, int32_t inputs_row_offset, int32_t local_gradients_row_offset)
 

Protected 属性

int32_t m_input_width
 
int32_t m_input_height
 
int32_t m_radius_x
 
int32_t m_radius_y
 
int32_t m_stride_x
 
int32_t m_stride_y
 
int32_t m_index
 
EConvMapActivationFunction m_activation_function
 
int32_t m_output_width
 
int32_t m_output_height
 
int32_t m_input_num_neurons
 
int32_t m_output_num_neurons
 
int32_t m_row_offset
 
int32_t m_filter_width
 
int32_t m_filter_height
 
ENLAutoencoderPosition m_autoencoder_position
 

构造及析构函数说明

CConvolutionalFeatureMap ( int32_t  input_width,
int32_t  input_height,
int32_t  radius_x,
int32_t  radius_y,
int32_t  stride_x = 1,
int32_t  stride_y = 1,
int32_t  index = 0,
EConvMapActivationFunction  function = CMAF_IDENTITY,
ENLAutoencoderPosition  autoencoder_position = NLAP_NONE 
)

Constuctor

参数
input_widthWidth of the input
input_heightHeight of the input
radius_xRadius of the convolution filter on the x (width) axis
radius_yRadius of the convolution filter on the y (height) axis
stride_xStride in the x direction
stride_yStride in the y direction
indexIndex of this feature map in its layer. This affects which part of the activations/activation_gradients matrix the map will store its outputs in.
functionActivation function
autoencoder_positionAutoencoder position

在文件 ConvolutionalFeatureMap.cpp 第 43 行定义.

成员函数说明

void compute_activations ( SGVector< float64_t >  parameters,
CDynamicObjectArray *  layers,
SGVector< int32_t >  input_indices,
SGMatrix< float64_t >  activations 
)

Computes the activations of the feature map

参数
parametersVector of parameters for the map. length width*height+(2*radius_x+1)+(2*radius_y+1)
layersThe layers array that forms the network in which the map is being used
input_indicesIndices of the layers that are connected to the map as input
activationsMatrix in which the activations are to be stored

在文件 ConvolutionalFeatureMap.cpp 第 77 行定义.

void compute_gradients ( SGVector< float64_t >  parameters,
SGMatrix< float64_t >  activations,
SGMatrix< float64_t >  activation_gradients,
CDynamicObjectArray *  layers,
SGVector< int32_t >  input_indices,
SGVector< float64_t >  parameter_gradients 
)

Computes the gradients with respect to the parameters and the inputs to the map

参数
parametersVector of parameters for the map. length width*height+(2*radius_x+1)+(2*radius_y+1)
activationsActivations of the map
activation_gradientsGradients of the error with respect to the map's activations
layersThe layers array that forms the network in which the map is being used
input_indicesIndices of the layers that are connected to the map as input
parameter_gradientsVector in which the parameters gradients are to be stored

在文件 ConvolutionalFeatureMap.cpp 第 131 行定义.

void compute_weight_gradients ( SGMatrix< float64_t >  inputs,
SGMatrix< float64_t >  local_gradients,
SGMatrix< float64_t >  weight_gradients,
int32_t  inputs_row_offset,
int32_t  local_gradients_row_offset 
)
protected

Computes the gradients of the error with respect to the weights, for a particular input matrix

参数
inputsInputs matrix
local_gradientsGradients with respect the map's pre-activations
weight_gradientsMatrix to store the gradients in
inputs_row_offsetOffset for accessing the rows of the inputs matrix
local_gradients_row_offsetOffset for accessing the rows of the local gradients matrix

在文件 ConvolutionalFeatureMap.cpp 第 315 行定义.

void convolve ( SGMatrix< float64_t >  inputs,
SGMatrix< float64_t >  weights,
SGMatrix< float64_t >  outputs,
bool  flip,
bool  reset_output,
int32_t  inputs_row_offset,
int32_t  outputs_row_offset 
)
protected

Perfoms convolution

参数
inputsInputs matrix. Each column in the matrix is treated as an image in column major format
weightsConvolution filter
outputsOutput matrix
flipIf true the weights are flipped, performing cross-correlation instead of convolution
reset_outputtrue the output is reset to zero before performing convolution
inputs_row_offsetIndex of the row at which the input image starts
outputs_row_offsetIndex of the row at which the output image starts

在文件 ConvolutionalFeatureMap.cpp 第 267 行定义.

void pool_activations ( SGMatrix< float64_t >  activations,
int32_t  pooling_width,
int32_t  pooling_height,
SGMatrix< float64_t >  pooled_activations,
SGMatrix< float64_t >  max_indices 
)

Applies max pooling to the activations

参数
activationsActivations of the map
pooling_widthWidth of the pooling region
pooling_heightHeight of the pooling region
pooled_activationsResult of the pooling process
max_indicesRow indices of the max elements for each pooling region

在文件 ConvolutionalFeatureMap.cpp 第 197 行定义.

类成员变量说明

EConvMapActivationFunction m_activation_function
protected

The map's activation function

在文件 ConvolutionalFeatureMap.h 第 199 行定义.

ENLAutoencoderPosition m_autoencoder_position
protected

For autoencoders, specifies the position of the layer in the autoencoder, i.e an encoding layer or a decoding layer. Default value is NLAP_NONE

在文件 ConvolutionalFeatureMap.h 第 225 行定义.

int32_t m_filter_height
protected

Height of the convolution filter

在文件 ConvolutionalFeatureMap.h 第 220 行定义.

int32_t m_filter_width
protected

Width of the convolution filter

在文件 ConvolutionalFeatureMap.h 第 217 行定义.

int32_t m_index
protected

Index of this feature map in its layer. This affects which part of the activations/activation_gradients matrix that map will use

在文件 ConvolutionalFeatureMap.h 第 196 行定义.

int32_t m_input_height
protected

Height of the input

在文件 ConvolutionalFeatureMap.h 第 179 行定义.

int32_t m_input_num_neurons
protected

Number of neurons in the input

在文件 ConvolutionalFeatureMap.h 第 208 行定义.

int32_t m_input_width
protected

Width of the input

在文件 ConvolutionalFeatureMap.h 第 176 行定义.

int32_t m_output_height
protected

Height of the convolution's output image

在文件 ConvolutionalFeatureMap.h 第 205 行定义.

int32_t m_output_num_neurons
protected

Number of neurons in the output

在文件 ConvolutionalFeatureMap.h 第 211 行定义.

int32_t m_output_width
protected

Width of the convolution's output image

在文件 ConvolutionalFeatureMap.h 第 202 行定义.

int32_t m_radius_x
protected

Radius of the convolution filter on the x (width) axis

在文件 ConvolutionalFeatureMap.h 第 182 行定义.

int32_t m_radius_y
protected

Radius of the convolution filter on the y (height) axis

在文件 ConvolutionalFeatureMap.h 第 185 行定义.

int32_t m_row_offset
protected

Row offset for accessing the activations

在文件 ConvolutionalFeatureMap.h 第 214 行定义.

int32_t m_stride_x
protected

Stride in the x direction

在文件 ConvolutionalFeatureMap.h 第 188 行定义.

int32_t m_stride_y
protected

Stride in the y direcetion

在文件 ConvolutionalFeatureMap.h 第 191 行定义.


该类的文档由以下文件生成:

SHOGUN 机器学习工具包 - 项目文档