コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #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);
        }