Esempio n. 1
0
        private static Network CreateModel()
        {
            var network = new Network(LossFunctionType.CrossEntropy, new Flat(0.001), NumberOfClasses);

            network.AddInputLayer(28, 1);
            network.AddConvolutionLayer(16, 5);
            network.AddActivationLayer(ActivatorType.Relu);
            network.AddPoolingLayer(2);
            network.AddConvolutionLayer(32, 5);
            network.AddActivationLayer(ActivatorType.Relu);
            network.AddPoolingLayer(2);
            network.AddFlattenLayer();
            network.AddDenseLayer(1024, true);
            network.AddActivationLayer(ActivatorType.Relu);
            network.AddDenseLayer(NumberOfClasses, false);
            network.AddSoftMaxLayer();

            network.RandomizeWeights(0.1);

            return(network);
        }
Esempio n. 2
0
        public void CNNTest()
        {
            network.AddInputLayer(7, 1);
            network.AddConvolutionLayer(2, 2);
            network.AddPoolingLayer(2);
            network.AddActivationLayer(ActivatorType.Relu);
            network.AddConvolutionLayer(3, 2);
            network.AddPoolingLayer(2);
            network.AddActivationLayer(ActivatorType.Relu);
            network.AddFlattenLayer();
            network.AddDenseLayer(5, true);
            network.AddActivationLayer(ActivatorType.Relu);
            network.AddDenseLayer(3, false);
            network.AddSoftMaxLayer();

            TestNetwork(network, "test1");
        }