Ejemplo n.º 1
0
        /// <summary>
        /// Creates convolutional layer with specified kernel, and appropriate map
        /// dimensions in regard to previous layer - fromLayer param
        /// </summary>
        /// <param name="fromLayer"> previous layer, which will be connected to this layer </param>
        /// <param name="kernel"> kernel for all feature maps in this layer </param>
        //    public ConvolutionalLayer(FeatureMapsLayer fromLayer, Kernel kernel) {
        //        Dimension2D fromDimension = fromLayer.getMapDimensions();
        //        int mapWidth = fromDimension.getWidth() - (kernel.getWidth() - 1);
        //        int mapHeight = fromDimension.getHeight() - (kernel.getHeight() - 1);
        //        this.mapDimensions = new Dimension2D(mapWidth, mapHeight);
        //
        //        createFeatureMaps(1, this.mapDimensions, ConvolutionalLayer.DEFAULT_NEURON_PROP);
        //    }

        /// <summary>
        /// Creates convolutional layer with specified kernel, appropriate map
        /// dimensions in regard to previous layer (fromLayer param) and specified
        /// number of feature maps with default neuron settings for convolutional
        /// layer.
        /// </summary>
        /// <param name="fromLayer"> previous layer, which will be connected to this layer </param>
        /// <param name="kernel"> kernel for all feature maps </param>
        /// <param name="numberOfMaps"> number of feature maps to create in this layer </param>
        public ConvolutionalLayer(FeatureMapsLayer fromLayer, Dimension2D kernelDimension, int numberOfMaps)
        {
            Dimension2D fromDimension = fromLayer.MapDimensions;

            int mapWidth  = fromDimension.Width - kernelDimension.Width + 1;
            int mapHeight = fromDimension.Height - kernelDimension.Height + 1;

            this.mapDimensions = new Dimension2D(mapWidth, mapHeight);

            createFeatureMaps(numberOfMaps, this.mapDimensions, kernelDimension, ConvolutionalLayer.DEFAULT_NEURON_PROP);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates convolutional layer with specified kernel, appropriate map
        /// dimensions in regard to previous layer (fromLayer param) and specified
        /// number of feature maps with given neuron properties.
        /// </summary>
        /// <param name="fromLayer"> previous layer, which will be connected to this layer </param>
        /// <param name="kernel"> kernel for all feature maps </param>
        /// <param name="numberOfMaps"> number of feature maps to create in this layer </param>
        /// <param name="neuronProp"> settings for neurons in feature maps </param>
        public ConvolutionalLayer(FeatureMapsLayer fromLayer, Dimension2D kernelDimension, int numberOfMaps, NeuronProperties neuronProp)
        {
            Dimension2D fromDimension = fromLayer.MapDimensions;

            int mapWidth  = fromDimension.Width - kernelDimension.Width + 1;
            int mapHeight = fromDimension.Height - kernelDimension.Height + 1;

            this.mapDimensions = new Dimension2D(mapWidth, mapHeight);

            createFeatureMaps(numberOfMaps, this.mapDimensions, kernelDimension, neuronProp);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates pooling layer with specified kernel, appropriate map
        /// dimensions in regard to previous layer (fromLayer param) and specified
        /// number of feature maps with given neuron properties.
        /// </summary>
        /// <param name="fromLayer">    previous layer, which will be connected to this layer </param>
        /// <param name="kernel">       kernel for all feature maps </param>
        /// <param name="numberOfMaps"> number of feature maps to create in this layer </param>
        /// <param name="neuronProp">   settings for neurons in feature maps </param>
        public PoolingLayer(FeatureMapsLayer fromLayer, Dimension2D kernelDim, int numberOfMaps, NeuronProperties neuronProp)
        {
            this.kernel = kernel;
            Dimension2D fromDimension = fromLayer.MapDimensions;

            int mapWidth  = fromDimension.Width / kernel.Width;
            int mapHeight = fromDimension.Height / kernel.Height;

            this.mapDimensions = new Dimension2D(mapWidth, mapHeight);

            createFeatureMaps(numberOfMaps, mapDimensions, kernelDim, neuronProp);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates pooling layer with specified kernel, appropriate map
        /// dimensions in regard to previous layer (fromLayer param) and specified
        /// number of feature maps with default neuron settings for pooling layer.
        /// Number of maps in pooling layer must be the same as number of maps in previous
        /// layer.
        /// </summary>
        /// <param name="fromLayer"> previous layer, which will be connected to this layer </param>
        /// <param name="kernel">    kernel for all feature maps </param>
        public PoolingLayer(FeatureMapsLayer fromLayer, Dimension2D kernelDim)
        {
            this.kernel = new Kernel(kernelDim);
            int         numberOfMaps  = fromLayer.NumberOfMaps;
            Dimension2D fromDimension = fromLayer.MapDimensions;

            int mapWidth  = fromDimension.Width / kernel.Width;
            int mapHeight = fromDimension.Height / kernel.Height;

            this.mapDimensions = new Dimension2D(mapWidth, mapHeight);

            createFeatureMaps(numberOfMaps, mapDimensions, kernelDim, DEFAULT_NEURON_PROP);
        }