Ejemplo n.º 1
0
 public ConvolutionLayer(ActivationType activationType, int neuronsCount, int kernelSize = 3, bool useReferences = false)
 {
     ActivationFunctionType = activationType;
     _function     = activationType.Get();
     KernelSize    = kernelSize;
     Neurons       = new ConvolutionNeuron[neuronsCount];
     Outputs       = new Matrix[neuronsCount];
     UseReferences = useReferences;
 }
Ejemplo n.º 2
0
        public void Init(int inputWidth, int inputHeight, int?outsPerNeuron)
        {
            OutputWidht  = inputWidth - KernelSize + 1;
            OutputHeight = inputHeight - KernelSize + 1;

            for (var i = 0; i < NeuronsCount; i++)
            {
                int?parentNeuron = null;

                if (UseReferences)
                {
                    parentNeuron = outsPerNeuron.HasValue && outsPerNeuron.Value > 0 ? i / outsPerNeuron : 0;
                }

                Neurons[i] = new ConvolutionNeuron(_function, inputWidth, inputHeight, KernelSize, parentNeuron);
            }
        }