Skip to content

Commit 5ff096c

Browse files
committed
1: Start example of Full Connected Neural Network.
2: Upgrade Microsoft.ML.TensorFlow.Redist to v1.14.
1 parent 316ad5f commit 5ff096c

File tree

6 files changed

+67
-9
lines changed

6 files changed

+67
-9
lines changed

src/TensorFlowNET.Core/TensorFlowNET.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Docs: https://tensorflownet.readthedocs.io</Description>
5454

5555
<ItemGroup>
5656
<PackageReference Include="Google.Protobuf" Version="3.8.0" />
57-
<PackageReference Include="Microsoft.ML.TensorFlow.Redist" Version="0.13.0" />
57+
<PackageReference Include="Microsoft.ML.TensorFlow.Redist" Version="0.14.0" />
5858
<PackageReference Include="NumSharp" Version="0.10.3" />
5959
</ItemGroup>
6060

test/KerasNET.Test/Keras.UnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</PropertyGroup>
2727

2828
<ItemGroup>
29-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
29+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
3030
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
3131
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
3232
</ItemGroup>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using Tensorflow;
5+
using TensorFlowNET.Examples.Utility;
6+
7+
namespace TensorFlowNET.Examples.ImageProcess
8+
{
9+
/// <summary>
10+
/// Neural Network classifier for Hand Written Digits
11+
/// Sample Neural Network architecture with two layers implemented for classifying MNIST digits
12+
/// http://www.easy-tensorflow.com/tf-tutorials/neural-networks
13+
/// </summary>
14+
public class DigitRecognitionNN : IExample
15+
{
16+
public bool Enabled { get; set; } = true;
17+
public bool IsImportingGraph { get; set; } = false;
18+
19+
public string Name => "Digits Recognition Neural Network";
20+
21+
const int img_h = 28;
22+
const int img_w = 28;
23+
int img_size_flat = img_h * img_w; // 784, the total number of pixels
24+
int n_classes = 10; // Number of classes, one class per digit
25+
int training_epochs = 10;
26+
int? train_size = null;
27+
int validation_size = 5000;
28+
int? test_size = null;
29+
int batch_size = 100;
30+
Datasets mnist;
31+
32+
public bool Run()
33+
{
34+
PrepareData();
35+
return true;
36+
}
37+
38+
public Graph BuildGraph()
39+
{
40+
throw new NotImplementedException();
41+
}
42+
43+
public Graph ImportGraph()
44+
{
45+
throw new NotImplementedException();
46+
}
47+
48+
public bool Predict()
49+
{
50+
throw new NotImplementedException();
51+
}
52+
53+
public void PrepareData()
54+
{
55+
mnist = MnistDataSet.read_data_sets("mnist", one_hot: true, train_size: train_size, validation_size: validation_size, test_size: test_size);
56+
}
57+
58+
public bool Train()
59+
{
60+
throw new NotImplementedException();
61+
}
62+
}
63+
}

test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
1818
<PackageReference Include="SharpZipLib" Version="1.1.0" />
1919
<PackageReference Include="System.Drawing.Common" Version="4.5.1" />
20-
<PackageReference Include="TensorFlow.NET" Version="0.8.2" />
20+
<PackageReference Include="TensorFlow.NET" Version="0.8.3" />
2121
</ItemGroup>
2222

2323
<ItemGroup>

test/TensorFlowNET.Examples/TextProcess/CnnTextClassification.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ public bool Run()
6161
valid_y = y[new Slice(start: train_size)];
6262
Console.WriteLine("\tDONE");
6363

64-
train_x = np.Load<int[,]>(Path.Join("word_cnn", "train_x.npy"));
65-
valid_x = np.Load<int[,]>(Path.Join("word_cnn", "valid_x.npy"));
66-
train_y = np.Load<int[]>(Path.Join("word_cnn", "train_y.npy"));
67-
valid_y = np.Load<int[]>(Path.Join("word_cnn", "valid_y.npy"));
68-
6964
return (train_x, valid_x, train_y, valid_y);
7065
}
7166

test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
2020
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
2121
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
2222
</ItemGroup>

0 commit comments

Comments
 (0)