2: Upgrade Microsoft.ML.TensorFlow.Redist to v1.14.tags/v0.9
| @@ -54,7 +54,7 @@ Docs: https://tensorflownet.readthedocs.io</Description> | |||||
| <ItemGroup> | <ItemGroup> | ||||
| <PackageReference Include="Google.Protobuf" Version="3.8.0" /> | <PackageReference Include="Google.Protobuf" Version="3.8.0" /> | ||||
| <PackageReference Include="Microsoft.ML.TensorFlow.Redist" Version="0.13.0" /> | |||||
| <PackageReference Include="Microsoft.ML.TensorFlow.Redist" Version="0.14.0" /> | |||||
| <PackageReference Include="NumSharp" Version="0.10.3" /> | <PackageReference Include="NumSharp" Version="0.10.3" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| @@ -26,7 +26,7 @@ | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" /> | |||||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" /> | |||||
| <PackageReference Include="MSTest.TestAdapter" Version="1.4.0" /> | <PackageReference Include="MSTest.TestAdapter" Version="1.4.0" /> | ||||
| <PackageReference Include="MSTest.TestFramework" Version="1.4.0" /> | <PackageReference Include="MSTest.TestFramework" Version="1.4.0" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| @@ -0,0 +1,63 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| using Tensorflow; | |||||
| using TensorFlowNET.Examples.Utility; | |||||
| namespace TensorFlowNET.Examples.ImageProcess | |||||
| { | |||||
| /// <summary> | |||||
| /// Neural Network classifier for Hand Written Digits | |||||
| /// Sample Neural Network architecture with two layers implemented for classifying MNIST digits | |||||
| /// http://www.easy-tensorflow.com/tf-tutorials/neural-networks | |||||
| /// </summary> | |||||
| public class DigitRecognitionNN : IExample | |||||
| { | |||||
| public bool Enabled { get; set; } = true; | |||||
| public bool IsImportingGraph { get; set; } = false; | |||||
| public string Name => "Digits Recognition Neural Network"; | |||||
| const int img_h = 28; | |||||
| const int img_w = 28; | |||||
| int img_size_flat = img_h * img_w; // 784, the total number of pixels | |||||
| int n_classes = 10; // Number of classes, one class per digit | |||||
| int training_epochs = 10; | |||||
| int? train_size = null; | |||||
| int validation_size = 5000; | |||||
| int? test_size = null; | |||||
| int batch_size = 100; | |||||
| Datasets mnist; | |||||
| public bool Run() | |||||
| { | |||||
| PrepareData(); | |||||
| return true; | |||||
| } | |||||
| public Graph BuildGraph() | |||||
| { | |||||
| throw new NotImplementedException(); | |||||
| } | |||||
| public Graph ImportGraph() | |||||
| { | |||||
| throw new NotImplementedException(); | |||||
| } | |||||
| public bool Predict() | |||||
| { | |||||
| throw new NotImplementedException(); | |||||
| } | |||||
| public void PrepareData() | |||||
| { | |||||
| mnist = MnistDataSet.read_data_sets("mnist", one_hot: true, train_size: train_size, validation_size: validation_size, test_size: test_size); | |||||
| } | |||||
| public bool Train() | |||||
| { | |||||
| throw new NotImplementedException(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -17,7 +17,7 @@ | |||||
| <PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> | <PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> | ||||
| <PackageReference Include="SharpZipLib" Version="1.1.0" /> | <PackageReference Include="SharpZipLib" Version="1.1.0" /> | ||||
| <PackageReference Include="System.Drawing.Common" Version="4.5.1" /> | <PackageReference Include="System.Drawing.Common" Version="4.5.1" /> | ||||
| <PackageReference Include="TensorFlow.NET" Version="0.8.2" /> | |||||
| <PackageReference Include="TensorFlow.NET" Version="0.8.3" /> | |||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| @@ -61,11 +61,6 @@ namespace TensorFlowNET.Examples | |||||
| valid_y = y[new Slice(start: train_size)]; | valid_y = y[new Slice(start: train_size)]; | ||||
| Console.WriteLine("\tDONE"); | Console.WriteLine("\tDONE"); | ||||
| train_x = np.Load<int[,]>(Path.Join("word_cnn", "train_x.npy")); | |||||
| valid_x = np.Load<int[,]>(Path.Join("word_cnn", "valid_x.npy")); | |||||
| train_y = np.Load<int[]>(Path.Join("word_cnn", "train_y.npy")); | |||||
| valid_y = np.Load<int[]>(Path.Join("word_cnn", "valid_y.npy")); | |||||
| return (train_x, valid_x, train_y, valid_y); | return (train_x, valid_x, train_y, valid_y); | ||||
| } | } | ||||
| @@ -16,7 +16,7 @@ | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" /> | |||||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" /> | |||||
| <PackageReference Include="MSTest.TestAdapter" Version="1.4.0" /> | <PackageReference Include="MSTest.TestAdapter" Version="1.4.0" /> | ||||
| <PackageReference Include="MSTest.TestFramework" Version="1.4.0" /> | <PackageReference Include="MSTest.TestFramework" Version="1.4.0" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||