Пример #1
0
        public void CreateAndCompileModel3()
        {
            Console.WriteLine("Creating model");
            GlobalRandom.InitializeRandom();

            int imgSize = 75;

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

            model = new ConvolutionalNeuralNetwork(imgSize, "rgb");
            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, softmaxActivation));

            Console.WriteLine("Model created");

            model.Compile();

            Console.WriteLine("Model compiled");
        }
Пример #2
0
        public void CreateAndCompileModel(string jsonPath, string weightsDirectory)
        {
            Console.WriteLine("Creating model");
            GlobalRandom.InitializeRandom();

            model = new ConvolutionalNeuralNetwork(jsonPath);

            Console.WriteLine("Model created");

            model.Compile();

            Console.WriteLine("Model compiled");
            Console.WriteLine("Reading weights");
            //ReadWeightsFromDirectory(weightsDirectory);

            ReadWeightsFromDirectory(weightsDirectory);
        }
Пример #3
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");
        }