MxNetLib 1.1.2

Suggested Alternatives

MxNet.Sharp

dotnet add package MxNetLib --version 1.1.2                
NuGet\Install-Package MxNetLib -Version 1.1.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MxNetLib" Version="1.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MxNetLib --version 1.1.2                
#r "nuget: MxNetLib, 1.1.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MxNetLib as a Cake Addin
#addin nuget:?package=MxNetLib&version=1.1.2

// Install MxNetLib as a Cake Tool
#tool nuget:?package=MxNetLib&version=1.1.2                

MxNet

Apache MXNet (incubating) is a deep learning framework designed for both efficiency and flexibility. It allows you to mix symbolic and imperative programming to maximize efficiency and productivity. At its core, MXNet contains a dynamic dependency scheduler that automatically parallelizes both symbolic and imperative operations on the fly. A graph optimization layer on top of that makes symbolic execution fast and memory efficient. MXNet is portable and lightweight, scaling effectively to multiple GPUs and multiple machines.

MXNet is more than a deep learning project. It is a collection of blue prints and guidelines for building deep learning systems, and interesting insights of DL systems for hackers.

mxnetlib is a CSharp binding coving all the Imperative and Symbolic API's with an easy to use interface. Also developed a high level interface to build and train model.

Setup MxNet for Windows: https://github.com/deepakkumar1984/mxnetlib/wiki/Setup---Windows

Nuget

Install the package: Install-Package MxNetLib

https://www.nuget.org/packages/MxNetLib

Symbolic Example

model.SetInput(784);

var x = Symbol.Variable("X");
var fc1 = sym.Relu(sym.FullyConnected(x, Symbol.Variable("fc1_w"), 128));
var fc2 = sym.Relu(sym.FullyConnected(fc1, Symbol.Variable("fc2_w"), 128));
var fc3 = sym.FullyConnected(fc2, Symbol.Variable("fc3_w"), 10);
var output = sym.SoftmaxOutput(fc3, Symbol.Variable("label"), symbol_name: "model");

model.SetDefaultInitializer(new RandomUniform(-1, 1));
model.Compile(output, OptimizerRegistry.SGD(), MetricType.Accuracy);

High Level API Example

model.SetInput(784);

model.Add(new Dense(128, ActivationType.ReLU, kernalInitializer: new RandomUniform(-1, 1)));
model.Add(new Dense(128, ActivationType.ReLU, kernalInitializer: new RandomUniform(-1, 1)));
model.Add(new Dense(10));

model.Compile(OptimizerRegistry.SGD(), LossType.SoftmaxCategorialCrossEntropy, MetricType.Accuracy);

Train and Inference


//Training for 10 epoch
model.Fit(train, 10, batchSize, val);

//Load test data
ImageDataFrame frame = new ImageDataFrame(1, 28, 28);
frame.LoadImages("test_6.png", "test_4.png", "test_4.png", "test_6.png");
NDArray test = frame.ToVariable().Ravel() / 255;

// Predict
var prediction = model.Predict(test).Argmax();
Console.WriteLine(prediction.ToString());

Saving and Loading model and checkpoint

string modelFolder = "../../../model";
model.SaveModel(modelFolder);
model.SaveCheckpoint(modelFolder);

var loadedModel = Module.LoadModel(modelFolder);
loadedModel.LoadCheckpoint(modelFolder);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.2 1,464 6/7/2019 1.1.2 is deprecated because it is no longer maintained.
1.1.0 1,029 6/5/2019
1.0.6 1,135 5/10/2019
1.0.5 1,146 5/10/2019