Adding more edits to match tutorial changes
This commit is contained in:
Родитель
f8f01c6df2
Коммит
10b07bbf48
|
@ -9,14 +9,15 @@ using Windows.UI.Xaml.Media.Imaging;
|
|||
using Windows.AI.MachineLearning;
|
||||
using Windows.Media;
|
||||
using Windows.Storage.Streams;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MNIST_Demo
|
||||
{
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
private mnistModel modelGen = new mnistModel();
|
||||
private mnistModel modelGen;
|
||||
private mnistInput mnistInput = new mnistInput();
|
||||
private mnistOutput mnistOutput = new mnistOutput();
|
||||
private mnistOutput mnistOutput;
|
||||
//private LearningModelSession session;
|
||||
private Helper helper = new Helper();
|
||||
RenderTargetBitmap renderBitmap = new RenderTargetBitmap();
|
||||
|
@ -39,7 +40,7 @@ namespace MNIST_Demo
|
|||
LoadModel();
|
||||
}
|
||||
|
||||
private async void LoadModel()
|
||||
private async Task LoadModelAsync()
|
||||
{
|
||||
//Load a machine learning model
|
||||
StorageFile modelFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Assets/mnist.onnx"));
|
||||
|
@ -56,11 +57,11 @@ namespace MNIST_Demo
|
|||
mnistOutput = await modelGen.EvaluateAsync(mnistInput);
|
||||
|
||||
//Convert output to datatype
|
||||
IReadOnlyList<float> VectorImage = mnistOutput.Plus214_Output_0.GetAsVectorView();
|
||||
IList<float> ImageList = VectorImage.ToList();
|
||||
IReadOnlyList<float> vectorImage = mnistOutput.Plus214_Output_0.GetAsVectorView();
|
||||
IList<float> imageList = vectorImage.ToList();
|
||||
|
||||
//LINQ query to check for highest probability digit
|
||||
var maxIndex = ImageList.IndexOf(ImageList.Max());
|
||||
var maxIndex = imageList.IndexOf(imageList.Max());
|
||||
|
||||
//Display the results
|
||||
numberLabel.Text = maxIndex.ToString();
|
||||
|
|
Загрузка…
Ссылка в новой задаче