Exemplo n.º 1
0
        internal static void MaxPoolingTest()
        {
            InputLayer inputLayer = new InputLayer(20, 20, 2);

            MaxPoolingLayer mPLayer = new MaxPoolingLayer(2, 2, inputLayer);

            Debug.WriteLine(mPLayer.Width + " " + mPLayer.Height + " " + mPLayer.Depth);

            float[,,] inputValues = new float[20, 20, 2];
            int i = 0;

            for (int z = 0; z < 2; z++)
            {
                Debug.WriteLine($"{z} --------------------");
                for (int y = 0; y < 20; y++)
                {
                    StringBuilder sb = new StringBuilder();
                    for (int x = 0; x < 20; x++, i++)
                    {
                        if (x != 0)
                        {
                            sb.Append(", ");
                        }

                        inputValues[x, y, z] = i;
                        sb.Append(i);
                    }
                    Debug.WriteLine(sb.ToString());
                }
            }
            NNFeedData inputData = new NNFeedData(inputValues);

            NNDetailedFeedData outputData = inputLayer.FeedForward(inputData);

            outputData = mPLayer.FeedForward(outputData.OutputData);

            for (int z = 0; z < mPLayer.Depth; z++)
            {
                Debug.WriteLine($"{z} --------------------");
                for (int y = 0; y < mPLayer.Height; y++)
                {
                    StringBuilder sb = new StringBuilder();
                    for (int x = 0; x < mPLayer.Width; x++)
                    {
                        if (x != 0)
                        {
                            sb.Append(", ");
                        }

                        sb.Append($"{outputData.OutputData[outputData.OutputData.ToNeuronIndex(x, y, z)]}");
                    }
                    Debug.WriteLine(sb.ToString());
                }
            }
        }