Esempio n. 1
0
 public LayerNetManager(TrainDataManager trainDataManager, TrainParameters trainParameters)
 {
     LayerNet        = new List <Layer>();
     TrainParameters = trainParameters;
     LabelMap        = trainDataManager.LabelMap;
     InputDataShape  = trainDataManager.DataShapeIn;
     OutputDataShape = trainDataManager.DataShapeOut;
     LearningRate    = trainParameters.LearningRate;
     CreateLayNet(trainParameters);
 }
Esempio n. 2
0
        public void CreateLayNet(TrainParameters layNetParameter)
        {
            LayerNet = new List <Layer>();
            var inputLayer = new LayerInput(InputDataShape)
            {
                LayerIndex = 0
            };

            LayerNet.Add(inputLayer);
            layNetParameter.InterLayerStructs.ToList().ForEach(a =>
            {
                var dataShape = LayerNet.Last().ShapeOut;
                switch (a.LayerType)
                {
                case LayerType.FullConnectLayer:
                    var fullConnectedLayer = new LayerFullConnected(dataShape, a.NeureCount)
                    {
                        LayerIndex = LayerNet.Count
                    };
                    LayerNet.Add(fullConnectedLayer);
                    break;

                case LayerType.PoolingLayer:
                    var poolingLayer = new LayerPooling(dataShape)
                    {
                        LayerIndex = LayerNet.Count
                    };
                    LayerNet.Add(poolingLayer);
                    break;
                }
            });
            var outputLayer = new LayerOutput(LayerNet.Last().ShapeOut, OutputDataShape)
            {
                LayerIndex = LayerNet.Count
            };

            LayerNet.Add(outputLayer);
        }