Skip to content

Commit 1711109

Browse files
authored
Update README.md
1 parent 054fa90 commit 1711109

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
## What is it?
44
`NeuralNetwork.NET` is a .NET Standard 2.0 library that implements a Convolutional Neural Network with customizable layers, built from scratch with C#.
5-
It provides simple APIs to define a CNN structure and to train the network using Stochastic Gradient Descent, as well as methods to save/load a network in JSON/binary format and more.
5+
It provides simple APIs to define a CNN structure and to train the network using Stochastic Gradient Descent, as well as methods to save/load a network and its metadata and more.
66

77
There's also a secondary .NET Framework 4.7.1 library available, `NeuralNetwork.NET.Cuda` that leverages the GPU and the cuDNN toolkit to greatly increase the performances when training or using a neural network.
88

99
# Table of Contents
1010

1111
- [Quick start](#quick-start)
1212
- [Supervised learning](#supervised-learning)
13+
- [GPU acceleration](#gpu-acceleration)
1314
- [Serialization and deserialization](#serialization-and-deserialization)
14-
- [GPU acceleration](#gpu-acceleration)
1515
- [Requirements](#requirements)
1616

1717
# Quick start
@@ -46,18 +46,32 @@ TrainingSessionResult result = NetworkManager.TrainNetwork(network,
4646

4747
**Note:** the `NetworkManager` methods are also available as asynchronous APIs.
4848

49-
### Serialization and deserialization
49+
### GPU acceleration
5050

51-
The `INeuralNetwork` interface exposes a `SerializeAsJson` method that can be used to serialize any network at any given time.
52-
In order to get a new network instance from a serialized JSON string, just use the `NeuralNetworkLoader.TryLoadJson` method: it will parse the input text and automatically return a neural network with the original parameters.
51+
When using the `NeuralNetwork.NET.Cuda` additional library, it is possible to use a different implementation of the available layers that leverages the cuDNN toolkit and parallelizes most of the work on the available CUDA-enabled GPU. To do that, just create a network using the layers from the `CuDnnNetworkLayers` class to enable the GPU processing mode.
5352

54-
There's also an additional `Save` method to save a neural network to a binary file. This provides a small, easy to share file that contains all the info on the current network.
53+
Some of the cuDNN-powered layers support additional options than the default layers. Here's an example:
5554

56-
# GPU acceleration
55+
```C#
56+
INetworkLayer convolutional = CuDnnNetworkLayers.Convolutional(
57+
TensorInfo.CreateForRgbImage(32, 32),
58+
ConvolutionInfo.New(ConvolutionMode.CrossCorrelation, 1, 1, 2, 2), // Custom mode, padding and stride
59+
(10, 10), 20, ActivationFunctionType.ReLU);
60+
```
61+
62+
### Serialization and deserialization
5763

58-
When using the `NeuralNetwork.NET.Cuda` additional library, it is possible to use a different implementation of the available layers that leverages the cuDNN toolkit and parallelizes most of the work on the available CUDA-enabled GPU.
64+
The `INeuralNetwork` interface exposes a `Save` method that can be used to serialize any network at any given time.
65+
In order to get a new network instance from a saved file or stream, just use the `NeuralNetworkLoader.TryLoad` method.
66+
67+
As multiple layer types have different implementations across the available libraries, you can specify the layer providers to use when loading a saved network. For example, here's how to load a network using the cuDNN layers, when possible:
68+
69+
```C#
70+
FileInfo file = new FileInfo(@"C:\...\MySavedNetwork.nnet");
71+
INeuralNetwork network = NeuralNetworkLoader.TryLoad(file, CuDnnNetworkLayersDeserializer.Deserializer);
72+
```
5973

60-
Just create a network using the layers from the `CuDnnNetworkLayers` class to enable the GPU processing mode.
74+
There's also an additional `SaveMetadataAsJson` method to export the metadata of an `INeuralNetwork` instance.
6175

6276
# Requirements
6377

0 commit comments

Comments
 (0)