void TestMNISTDrawing(Noedify.Net net) { float[] modelInputs = sampleDrawing.SampleDrawing(new int[2] { 28, 28 }); float[,,] modelInputsFormatted = new float[1, 1, 28 * 28]; for (int i = 0; i < 28 * 28; i++) { modelInputsFormatted[0, 0, i] = modelInputs[i]; } System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); solver.Evaluate(net, modelInputsFormatted, Noedify_Solver.SolverMethod.MainThread); sw.Stop(); StartCoroutine(UpdatePlotWhenComplete()); }
IEnumerator PlotCostWhenComplete(Noedify_Solver solver, float[] cost) { while (solver.trainingInProgress) { yield return(null); } debugger.PlotCost(cost, new float[2] { 1.0f / no_epochs * 2.5f, 5 }, costPlotOrigin); for (int n = 0; n < predictionTester.sampleImagePlanes.Length; n++) { float[,,] testInputImage = new float[1, 1, 1]; Noedify_Utils.ImportImageData(ref testInputImage, predictionTester.sampleImageRandomSet[n], true); solver.Evaluate(net, testInputImage, Noedify_Solver.SolverMethod.MainThread); int prediction = Noedify_Utils.ConvertOneHotToInt(solver.prediction); predictionTester.CNN_predictionText[n].text = prediction.ToString(); } }
// Evaluate netowrk to generate decision float[] AIDecision(float[] observation) { evalSolver.Evaluate(simController.net, Noedify_Utils.AddTwoSingularDims(observation), Noedify_Solver.SolverMethod.MainThread); return(evalSolver.prediction); }