Browse Source

Update doc for gpu version.

tags/v0.12
Oceania2018 6 years ago
parent
commit
8c5d59a494
3 changed files with 26 additions and 3 deletions
  1. +6
    -0
      README.md
  2. +15
    -2
      tensorflowlib/README.md
  3. +5
    -1
      test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs

+ 6
- 0
README.md View File

@@ -28,8 +28,14 @@ In comparison to other projects, like for instance TensorFlowSharp which only pr

Install TF.NET and TensorFlow binary through NuGet.
```sh
### install tensorflow C# binding
PM> Install-Package TensorFlow.NET

### Install tensorflow binary
### For CPU version
PM> Install-Package SciSharp.TensorFlow.Redist
### For GPU version (CUDA and cuDNN are required)
PM> Install-Package SciSharp.TensorFlow.Redist-Windows-GPU
```

Import TF.NET.


+ 15
- 2
tensorflowlib/README.md View File

@@ -16,6 +16,8 @@ Here are some pre-built TensorFlow binaries you can use for each platform:
- CPU-only: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.14.0.zip
- GPU-enabled: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-1.14.0.zip



### Run in Linux

`Install-Package TensorFlow.NET`
@@ -31,10 +33,21 @@ sudo apt install libgdiplus

More information about [System.Drawing on Linux](<https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx>).



### Run in Mac OS

### GPU Tensorflow for windows
Before running verify you installed CUDA and cuDNN


### Tensorflow GPU for Windows

Before running verify you installed CUDA and cuDNN (TensorFlow v1.14 is compatible with CUDA v10.0 and cuDNN v7.4), and make sure the corresponding cuda version is compatible.

```powershell
PM> Install-Package SciSharp.TensorFlow.Redist-Windows-GPU
```



### Build from source for Windows



+ 5
- 1
test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs View File

@@ -16,6 +16,7 @@

using NumSharp;
using System;
using System.Diagnostics;
using Tensorflow;
using TensorFlowNET.Examples.Utility;
using static Tensorflow.Python;
@@ -144,6 +145,8 @@ namespace TensorFlowNET.Examples.ImageProcess
float loss_val = 100.0f;
float accuracy_val = 0f;

var sw = new Stopwatch();
sw.Start();
foreach (var epoch in range(epochs))
{
print($"Training epoch: {epoch + 1}");
@@ -165,7 +168,8 @@ namespace TensorFlowNET.Examples.ImageProcess
var result = sess.run(new[] { loss, accuracy }, new FeedItem(x, x_batch), new FeedItem(y, y_batch));
loss_val = result[0];
accuracy_val = result[1];
print($"iter {iteration.ToString("000")}: Loss={loss_val.ToString("0.0000")}, Training Accuracy={accuracy_val.ToString("P")}");
print($"iter {iteration.ToString("000")}: Loss={loss_val.ToString("0.0000")}, Training Accuracy={accuracy_val.ToString("P")} {sw.ElapsedMilliseconds}ms");
sw.Restart();
}
}



Loading…
Cancel
Save