Browse Source

fix default graph issue for DigitRecognitionNN.

tags/v0.9
Oceania2018 6 years ago
parent
commit
da48a2af83
3 changed files with 15 additions and 13 deletions
  1. +7
    -9
      src/TensorFlowNET.Core/TensorFlowNET.Core.csproj
  2. +7
    -3
      test/TensorFlowNET.Examples/ImageProcess/DigitRecognitionNN.cs
  3. +1
    -1
      test/TensorFlowNET.Examples/TextProcess/CnnTextClassification.cs

+ 7
- 9
src/TensorFlowNET.Core/TensorFlowNET.Core.csproj View File

@@ -5,7 +5,7 @@
<AssemblyName>TensorFlow.NET</AssemblyName>
<RootNamespace>Tensorflow</RootNamespace>
<TargetTensorFlow>1.14.0</TargetTensorFlow>
<Version>0.8.3</Version>
<Version>0.9.0</Version>
<Authors>Haiping Chen, Meinrad Recheis</Authors>
<Company>SciSharp STACK</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -17,16 +17,14 @@
<PackageTags>TensorFlow, NumSharp, SciSharp, MachineLearning, TensorFlow.NET, C#</PackageTags>
<Description>Google's TensorFlow full binding in .NET Standard.
Docs: https://tensorflownet.readthedocs.io</Description>
<AssemblyVersion>0.8.3.0</AssemblyVersion>
<PackageReleaseNotes>Changes since v0.8:
<AssemblyVersion>0.9.0.0</AssemblyVersion>
<PackageReleaseNotes>Changes since v0.8.3:

1. Remove global static graph instance.
2. Provide custom gradient function.
3. Add gradient function for Conv2D.
4. Fix bug for Transfer Learning example.
5. Overload Graph.Import(byte[] bytes)</PackageReleaseNotes>
1. Added full connected Neural Network example.
2. Added word CNN Text Classification example.
3. Fixed AdaOptimizer issue.</PackageReleaseNotes>
<LangVersion>7.2</LangVersion>
<FileVersion>0.8.3.0</FileVersion>
<FileVersion>0.9.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">


+ 7
- 3
test/TensorFlowNET.Examples/ImageProcess/DigitRecognitionNN.cs View File

@@ -40,15 +40,19 @@ namespace TensorFlowNET.Examples.ImageProcess

public bool Run()
{
bool successful = false;

PrepareData();
BuildGraph();
Train();
successful = Train();

return true;
return successful;
}

public Graph BuildGraph()
{
var graph = new Graph().as_default();

// Placeholders for inputs (x) and outputs(y)
x = tf.placeholder(tf.float32, shape: (-1, img_size_flat), name: "X");
y = tf.placeholder(tf.float32, shape: (-1, n_classes), name: "Y");
@@ -67,7 +71,7 @@ namespace TensorFlowNET.Examples.ImageProcess
// Network predictions
var cls_prediction = tf.argmax(output_logits, axis: 1, name: "predictions");

return tf.get_default_graph();
return graph;
}

private Tensor fc_layer(Tensor x, int num_units, string name, bool use_relu = true)


+ 1
- 1
test/TensorFlowNET.Examples/TextProcess/CnnTextClassification.cs View File

@@ -298,7 +298,7 @@ namespace TensorFlowNET.Examples
}
}

return max_accuracy > 0.8;
return max_accuracy > 0.9;
}

public bool Train()


Loading…
Cancel
Save