Exemple #1
0
        private Function DefineModel_104A(Example_103_Util util, Variable inputVariables, DeviceDescriptor device)
        {
            var normalizedInput = CNTKLib.ElementTimes(Constant.Scalar <double>(1.0 / 255.0, device), inputVariables);
            var encode3         = util.DenseNode(normalizedInput, 32, CNTKLib.ReLU);
            var decoder         = util.DenseNode(encode3, 28 * 28, CNTKLib.Sigmoid);

            return(decoder);
        }
Exemple #2
0
        private Function DefineModel_103C(Example_103_Util util, int nbLabels, Variable inputVariables)
        {
            Func <Variable, Function> activation = CNTKLib.ReLU;

            var layer1    = util.DenseNode(inputVariables, 400, activation);
            var layer2    = util.DenseNode(layer1, 200, activation);
            var lastLayer = util.DenseNode(layer2, nbLabels, null); // linear layer

            return(lastLayer);
        }
Exemple #3
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);
        }
Exemple #4
0
        Function DefineModel_LSTM(Variable input, int memoryLengthDim, int outputDims)
        {
            var      lstm         = _util.LSTMNode(input, memoryLengthDim);
            Function sequenceLast = CNTKLib.SequenceLast(lstm.H_output);
            Function dropout      = CNTKLib.Dropout(sequenceLast, 0.2, 1);
            Function dense        = _util.DenseNode(dropout, outputDims, null);

            return(dense);
        }
Exemple #5
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);
        }
Exemple #6
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);
        }
Exemple #7
0
        private Function DefineModel_E(Variable input, int nbLabels, Example_103_Util util)
        {
            Func <Variable, Function> activation = CNTKLib.ReLU;

            Variable net = input;

            net = util.ConvolutionWithBatchNormalization(net, new[] { 3, 3 }, 16, activation);
            net = util.ResNetBasicStack(net, 16, 3, activation);

            net = util.ResNetInc(net, 32, activation);
            net = util.ResNetBasicStack(net, 32, 2, activation);

            net = util.ResNetInc(net, 64, activation);
            net = util.ResNetBasicStack(net, 64, 2, activation);

            net = util.PoolingMax(net, new[] { 8, 8 }, new[] { 1, 1 });
            net = util.DenseNode(net, nbLabels, null);

            return(net);
        }
Exemple #8
0
 private Function DefineModel_103B(Example_103_Util util, int nbLabels, Variable inputVariables)
 {
     return(util.DenseNode(inputVariables, nbLabels, null));
 }