public void AddEdgeDetectionLayers() { ConvolutionalLayers.Add(new ConvolutionalLayer { Filter = new ConvolutionalFilter { Weights = ConvolutionalFilters.TopEdgeDetection } }); ConvolutionalLayers.Add(new ConvolutionalLayer { Filter = new ConvolutionalFilter { Weights = ConvolutionalFilters.BottomEdgeDetection } }); ConvolutionalLayers.Add(new ConvolutionalLayer { Filter = new ConvolutionalFilter { Weights = ConvolutionalFilters.LeftEdgeDetection } }); ConvolutionalLayers.Add(new ConvolutionalLayer { Filter = new ConvolutionalFilter { Weights = ConvolutionalFilters.RightEdgeDetection } }); }
public NN_Convolutional(Bitmap image, int convolutionalLayerCount, int convolutionalNeuronCount, int outputCount, bool applyEdgeDetection) { NetworkType = NetworkTypes.Convolutional; InputImage = image; ApplyEdgeDetection = applyEdgeDetection; //Input var inputLayer = new ConvolutionalLayer(); for (var i = 0; i < image.Width; i++) { for (var j = 0; j < image.Height; j++) { inputLayer.InputPixels.Add(new ConvolutionalLayer.PixelInfo { Coordinates = new Point(i, j), Color = image.GetPixel(i, j) }); } } ConvolutionalLayers.Add(inputLayer); //Filters if (applyEdgeDetection) { AddEdgeDetectionLayers(); } //Output layers for (var i = 0; i < outputCount; i++) { OutputLayer.Neurons.Add(new Neuron()); } }