Package deepnetts.net.layers
Class ConvolutionalLayer
java.lang.Object
deepnetts.net.layers.AbstractLayer<Tensor3D,Tensor3D,Tensor4D>
deepnetts.net.layers.ConvolutionalLayer
- All Implemented Interfaces:
Layer<Tensor3D>
,Serializable
Convolutional layer performs image convolution operation on outputs of a
previous layer using filters. This filtering operation is similar like
applying image filters in photoshop, but this filters can also be trained to
learn image features of interest.
Layer include parameters: filter's width, heigh Number of filters / depth
Step when applying filters : stride Padding, which is an image border to keep
the size of image and avoid information loss padding Stride defaults to 1
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConvolutionalLayer
(int channels, int filterWidth, int filterHeight) Create a new instance of convolutional layer with specified number of channels filter size, default padding (filter-1)/2, and default stride stride value 1, and specified number of channels.ConvolutionalLayer
(int channels, int filterWidth, int filterHeight, int stride, ActivationType activationType) ConvolutionalLayer
(int channels, Filter filter) ConvolutionalLayer
(int channels, Filter filter, ActivationType activationType) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Apply weight changes calculated in backward passvoid
backward()
Backward pass for convolutional layer tweaks the weights in filters.void
void
forward()
Forward pass for convolutional layer.int
int
int
float
float
int
int
void
init()
Initialize dimensions, create output tensors, filters/weights, biases and all internal structures etc.void
void
setFilters
(Tensor4D filters) void
setFilters
(String filtersStr) toString()
Methods inherited from class deepnetts.net.layers.AbstractLayer
getActivation, getActivationType, getBatchSize, getBiases, getDeltaBiases, getDeltas, getDeltaWeights, getDepth, getForwardAccelerator, getGradients, getHeight, getL1Regularization, getL2Regularization, getLearningRate, getMode, getMomentum, getNextLayer, getOptimizer, getOptimizerType, getOutputs, getPrevDeltaBiases, getPrevDeltaWeights, getPrevlayer, getWidth, isBatchMode, isTrainable, setBatchMode, setBatchSize, setBiases, setCudaHandles, setDeltas, setL1Regularization, setL2Regularization, setLearningRate, setMode, setMomentum, setNextlayer, setOptimizerType, setOutputs, setPrevDeltaWeights, setPrevLayer, setThreadPool, setTrainable, setWeights, setWeights
-
Constructor Details
-
ConvolutionalLayer
public ConvolutionalLayer(int channels, int filterWidth, int filterHeight) Create a new instance of convolutional layer with specified number of channels filter size, default padding (filter-1)/2, and default stride stride value 1, and specified number of channels. Uses Linear activation function by default.- Parameters:
channels
- number of channels which corresponds to the number of image pixel feature that you want to learn and detectfilterWidth
-filterHeight
-
-
ConvolutionalLayer
-
ConvolutionalLayer
-
ConvolutionalLayer
public ConvolutionalLayer(int channels, int filterWidth, int filterHeight, int stride, ActivationType activationType)
-
-
Method Details
-
init
public void init()Initialize dimensions, create output tensors, filters/weights, biases and all internal structures etc. Assumes that prevLayer is set in network builder- Specified by:
init
in classAbstractLayer<Tensor3D,
Tensor3D, Tensor4D>
-
initTransientFields
public void initTransientFields()- Overrides:
initTransientFields
in classAbstractLayer<Tensor3D,
Tensor3D, Tensor4D>
-
forward
public void forward()Forward pass for convolutional layer. Performs convolution operation on output from previous layer using filters in this layer, on all channels. Each channel from prev layer has its own filter (3D filter), and every channel in this layer has its 3D filter used to scan all channels in prev layer. Previous layers can be: Input, MaxPooling or Convolutional. For more about convolution see http://www.songho.ca/dsp/convolution/convolution.html -
createFilterCache
public void createFilterCache() -
backward
public void backward()Backward pass for convolutional layer tweaks the weights in filters. Next layer can be: FC, MaxPooling, Conv, (output same as FC), 1D or 3D Prev layer can: Input, pool, conv, all 2D or 3D - all can be as generalized 3D U 2 koraka: 1. povuci delte iz sledeceg lejera, i izracunaj tezinsku sumu delta za sve neurone/outpute u ovom sloju 2. izracunaj promene tezina za sve veze iz prethodnog lejera za svaki neuron/output u ovom sloju -
applyWeightChanges
public void applyWeightChanges()Apply weight changes calculated in backward pass- Specified by:
applyWeightChanges
in classAbstractLayer<Tensor3D,
Tensor3D, Tensor4D>
-
getFilters
-
getWeights
- Overrides:
getWeights
in classAbstractLayer<Tensor3D,
Tensor3D, Tensor4D>
-
setFilters
-
setFilters
-
getFilterWidth
public int getFilterWidth() -
getFilterHeight
public int getFilterHeight() -
getFilterDepth
public int getFilterDepth() -
getStride
public int getStride() -
getPadding
public int getPadding() -
getFilterDeltaWeights
-
getL1WeightSum
public float getL1WeightSum()- Overrides:
getL1WeightSum
in classAbstractLayer<Tensor3D,
Tensor3D, Tensor4D>
-
getL2WeightSum
public float getL2WeightSum()- Overrides:
getL2WeightSum
in classAbstractLayer<Tensor3D,
Tensor3D, Tensor4D>
-
toString
-