Exemple #1
0
        public void CreateAndCompileModel2()
        {
            Console.WriteLine("Creating model");
            GlobalRandom.InitializeRandom();

            int imgSize = 75;

            ReluActivation    reluActivation    = new ReluActivation();
            SoftmaxActivation softmaxActivation = new SoftmaxActivation();
            SigmoidActivation sigmoidActivation = new SigmoidActivation();

            model = new ConvolutionalNeuralNetwork(imgSize, "grayscale");
            model.Add(new ConvolutionalLayer(5, 5, reluActivation, "valid"));
            model.Add(new MaxPoolingLayer());
            model.Add(new ConvolutionalLayer(5, 3, reluActivation, "valid"));
            model.Add(new MaxPoolingLayer());
            model.Add(new DropoutLayer(0.2));
            model.Add(new FlattenLayer());
            model.Add(new DropoutLayer(0.5));
            model.Add(new DenseLayer(26, sigmoidActivation));

            Console.WriteLine("Model created");

            model.Compile();

            Console.WriteLine("Model compiled");
        }
Exemple #2
0
        public void CreateAndCompileModelMnist()
        {
            Console.WriteLine("Creating model");
            GlobalRandom.InitializeRandom();

            int imgSize = 28;

            NoActivation      noActivation      = new NoActivation();
            SoftmaxActivation softmaxActivation = new SoftmaxActivation();

            model = new ConvolutionalNeuralNetwork(imgSize, "grayscale");
            model.Add(new ConvolutionalLayer(8, 3, noActivation, "valid"));
            model.Add(new MaxPoolingLayer());
            model.Add(new FlattenLayer());
            model.Add(new DenseLayer(10, softmaxActivation));

            Console.WriteLine("Model created");

            model.Compile();

            Console.WriteLine("Model compiled");
        }