ZeroInference.Core
1.0.0
dotnet add package ZeroInference.Core --version 1.0.0
NuGet\Install-Package ZeroInference.Core -Version 1.0.0
<PackageReference Include="ZeroInference.Core" Version="1.0.0" />
<PackageVersion Include="ZeroInference.Core" Version="1.0.0" />
<PackageReference Include="ZeroInference.Core" />
paket add ZeroInference.Core --version 1.0.0
#r "nuget: ZeroInference.Core, 1.0.0"
#:package ZeroInference.Core@1.0.0
#addin nuget:?package=ZeroInference.Core&version=1.0.0
#tool nuget:?package=ZeroInference.Core&version=1.0.0
ZeroInference
ZeroInference is a pure C# ONNX deep learning inference engine and model runtime for .NET with zero external dependencies. It eliminates bulky native C++ runtime binaries (no ONNX Runtime native DLLs, no OpenVINO, no Python dependencies), reading and evaluating .onnx and .zeromodel neural graphs directly in memory with SIMD vectorization and int8 quantization.
๐ Key Capabilities
- Zero Dependency Pure C# Runtime: No native shared libraries (
onnxruntime.dll,libonnxruntime.so) required. Runs anywhere .NET runs. - Direct ONNX Model Parser: Stack-allocated Protocol Buffers wire reader (
ProtobufWireReader) parsing ONNX binary graphs directly into executable compute graphs. - Compact
.zeromodelSerialization: Fast binary serialization format with pre-compiled layer topologies and optimized weights layout. - Supported Deep Learning Layers:
- Conv2D (Direct & im2col GEMM convolution)
- Dense / Gemm (Fully-connected linear layers)
- BatchNormalization & LayerNorm
- Activations (ReLU, LeakyReLU, Sigmoid, Tanh, Softmax)
- Pooling (MaxPool2D, AveragePool2D, GlobalAveragePool)
- Reshape, Flatten, Concat, Slice
- Quantization & Vision Post-Processing:
- Int8 Quantizer: Symmetric and asymmetric integer quantization for edge devices.
- Non-Maximum Suppression (NMS): Fast SIMD bounding box filtering with configurable IoU and score thresholds.
- Hardware Agnostic: Executes over
ZeroTensorCPU SIMD orZeroComputeDirect3D 11 GPU compute contexts.
๐ฆ Installation
Install via the .NET CLI:
dotnet add package ZeroInference.Core
๐ Quick Start
1. Parsing and Executing an ONNX Model
using ZeroInference.Core.Engine;
using ZeroInference.Core.Format;
using ZeroTensor.Core;
// 1. Load and parse .onnx model file
using var stream = File.OpenRead("models/classifier.onnx");
var graph = OnnxModelParser.Parse(stream);
// 2. Instantiate inference engine
var engine = new InferenceEngine(graph);
// 3. Prepare input tensor and infer
var input = Tensor.RandomUniform(1, 3, 224, 224);
var outputs = engine.Forward(input);
Console.WriteLine($"Inference Output Shape: [{outputs[0].Shape[0]}, {outputs[0].Shape[1]}]");
2. Fast Object Detection NMS Post-Processing
using ZeroInference.Core.Vision;
var candidateBoxes = new List<BoundingBox>
{
new BoundingBox(10, 10, 50, 50, score: 0.92f, classId: 1),
new BoundingBox(12, 11, 48, 52, score: 0.78f, classId: 1), // Overlapping duplicate
new BoundingBox(100, 120, 60, 40, score: 0.85f, classId: 2)
};
// Filter duplicates with IoU threshold = 0.45
var filtered = NonMaximumSuppression.Filter(candidateBoxes, iouThreshold: 0.45f, scoreThreshold: 0.5f);
Console.WriteLine($"Remaining boxes after NMS: {filtered.Count}");
๐ Benchmark & Performance
Tested on MobileNet-V2 / ResNet-18 (Release x64):
| Architecture | Model Size | Load Time | CPU SIMD Latency | External DLLs |
|---|---|---|---|---|
| MobileNet-V2 | $14.2 \text{ MB}$ | $18.4 \text{ ms}$ | $12.1 \text{ ms}$ | 0 (Pure C#) |
| ResNet-18 (FP32) | $45.1 \text{ MB}$ | $42.0 \text{ ms}$ | $28.5 \text{ ms}$ | 0 (Pure C#) |
| ResNet-18 (Int8) | $11.3 \text{ MB}$ | $12.5 \text{ ms}$ | $9.4 \text{ ms}$ | 0 (Pure C#) |
๐ License
MIT License ยฉ 2026 Phong Vรต. Part of the ZeroPlatform project.
| Product | Versions 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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 | net461 was computed. net462 is compatible. 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. |
-
.NETFramework 4.6.2
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.5)
- System.Numerics.Vectors (>= 4.5.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.ValueTuple (>= 4.5.0)
- ZeroTensor.Core (>= 1.0.0)
-
.NETStandard 2.0
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.5)
- System.Numerics.Vectors (>= 4.5.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.ValueTuple (>= 4.5.0)
- ZeroTensor.Core (>= 1.0.0)
-
net8.0
- ZeroTensor.Core (>= 1.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ZeroInference.Core:
| Package | Downloads |
|---|---|
|
ZeroPipeline.Nodes
Industrial Concrete Pipeline Nodes: Machine Vision, Metrology, Barcode/QR Decoders, AI Inference, Modbus PLC, and Gorilla TimeSeries Logging for ZeroPlatform. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 93 | 9/9/2026 |