Пример #1
0
        private void Test()
        {
            UnityEngine.Profiling.Profiler.BeginSample("Test");

            int correctTestLabels = 0;

            for (int i = 0; i < DataManager.Test.NumImgs; i++)
            {
                int lbl = (int)DataManager.Test.Labels[i];

                var handle = DataManager.CopyInput(_net.Inputs, DataManager.Test, i);
                handle = NeuralJobs.ForwardPass(_net, handle);
                handle.Complete();

                int predictedLbl = NeuralMath.ArgMax(_net.Last.Outputs);
                if (predictedLbl == lbl)
                {
                    correctTestLabels++;
                }
            }

            float accuracy = correctTestLabels / (float)DataManager.Test.NumImgs;

            Debug.Log("Test Accuracy: " + System.Math.Round(accuracy * 100f, 4) + "%");

            UnityEngine.Profiling.Profiler.EndSample();
        }