Пример #1
0
        private Function DefineModel_103D(Example_103_Util util, int nbLabels, Variable inputVariables)
        {
            Func <Variable, Function> activation = CNTKLib.ReLU;

            var layer1 = util.Convolution(inputVariables, new[] { 5, 5 }, 8, new[] { 1, 1 }, activation);
            var layer2 = util.Pooling(layer1, new[] { 2, 2 }, 8, new[] { 2, 2 });

            var layer3 = util.Convolution(layer2, new[] { 5, 5 }, 16, new[] { 1, 1 }, activation);
            var layer4 = util.Pooling(layer3, new[] { 3, 3 }, 16, new[] { 3, 3 });

            var lastLayer = util.DenseNode(layer4, nbLabels, null); // linear layer

            return(lastLayer);
        }
Пример #2
0
        private Function DefineModel_A(Variable input, int nbLabels, Example_103_Util util)
        {
            Func <Variable, Function> activation = CNTKLib.ReLU;

            var layer1 = util.Convolution(input, new[] { 5, 5 }, 32, activation);
            var layer2 = util.PoolingMax(layer1, new[] { 3, 3 }, new[] { 2, 2 });

            var layer3 = util.Convolution(layer2, new[] { 5, 5 }, 32, activation);
            var layer4 = util.PoolingMax(layer3, new[] { 3, 3 }, new[] { 2, 2 });

            var layer5 = util.Convolution(layer4, new[] { 5, 5 }, 64, activation);
            var layer6 = util.PoolingMax(layer5, new[] { 3, 3 }, new[] { 2, 2 });

            var layer7    = util.DenseNode(layer6, 64, activation); // linear layer
            var lastLayer = util.DenseNode(layer7, nbLabels, null); // linear layer

            return(lastLayer);
        }
Пример #3
0
        private Function DefineModel_D_Pourri(Variable input, int nbLabels, Example_103_Util util)
        {
            Func <Variable, Function> activation = CNTKLib.ReLU;

            Variable net = input;

            foreach (int dims in new[] { 64, 96, 128 })
            {
                net = util.Convolution(net, new[] { 3, 3 }, dims, activation);
                net = util.Convolution(net, new[] { 3, 3 }, dims, activation);
                net = util.PoolingMax(net, new[] { 3, 3 }, new int[] { 2, 2 });
            }

            for (int i = 0; i < 2; i++)
            {
                net = util.DenseNode(net, 1024, activation);
            }

            net = util.DenseNode(net, nbLabels, CNTKLib.Softmax);

            return(net);
        }