Contoso.AI.ImageSegmenterSINet
0.1.6-beta
This is a prerelease version of Contoso.AI.ImageSegmenterSINet.
dotnet add package Contoso.AI.ImageSegmenterSINet --version 0.1.6-beta
NuGet\Install-Package Contoso.AI.ImageSegmenterSINet -Version 0.1.6-beta
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="Contoso.AI.ImageSegmenterSINet" Version="0.1.6-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Contoso.AI.ImageSegmenterSINet" Version="0.1.6-beta" />
<PackageReference Include="Contoso.AI.ImageSegmenterSINet" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Contoso.AI.ImageSegmenterSINet --version 0.1.6-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Contoso.AI.ImageSegmenterSINet, 0.1.6-beta"
#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.
#:package Contoso.AI.ImageSegmenterSINet@0.1.6-beta
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Contoso.AI.ImageSegmenterSINet&version=0.1.6-beta&prerelease
#tool nuget:?package=Contoso.AI.ImageSegmenterSINet&version=0.1.6-beta&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Contoso.AI.ImageSegmenterSINet
AI-powered image segmentation using Qualcomm's SINet (Salient Image Network) ONNX model. Separates foreground from background in images with NPU hardware acceleration.
Quick Start
using Contoso.AI;
using System.Drawing;
// Check if the feature is ready
var readyState = ImageSegmenterSINet.GetReadyState();
if (readyState != AIFeatureReadyState.Ready)
{
// Prepare the feature (downloads QNN Execution Provider if needed)
var readyResult = await ImageSegmenterSINet.EnsureReadyAsync();
if (readyResult.Status != AIFeatureReadyResultState.Success)
{
Console.WriteLine($"Failed to initialize: {readyResult.ExtendedError?.Message}");
return;
}
}
// Create segmenter instance
using var segmenter = await ImageSegmenterSINet.CreateAsync();
// Segment an image
using var bitmap = new Bitmap("photo.jpg");
var result = segmenter.SegmentImage(bitmap);
// Extract foreground with transparent background
using var foreground = result.ExtractForeground(bitmap);
foreground.Save("foreground.png");
Features
- ✅ Foreground/background segmentation using SINet
- ✅ NPU hardware acceleration (QNN Execution Provider)
- ✅ Automatic model download at build time (both float and quantized models)
- ✅ Intelligent model selection: quantized for NPU, float for CPU
- ✅ Easy-to-use async factory pattern
- ✅ Multiple output formats (mask, overlay, extracted foreground)
Requirements
- Windows 10 SDK 19041+
- .NET 8.0+
- NPU recommended for best performance (falls back to CPU automatically)
Model Selection
The library automatically downloads two ONNX models at build time:
- Quantized (int8) model - Optimized for QNN NPU acceleration
- Float (fp32) model - Optimized for CPU execution
At runtime, CreateAsync() intelligently selects:
- Quantized model when QNN NPU is available
- Float model when falling back to CPU
This ensures optimal performance and compatibility across different hardware configurations.
API
| Method | Description |
|---|---|
ImageSegmenterSINet.GetReadyState() |
Check if feature is available |
ImageSegmenterSINet.EnsureReadyAsync() |
Prepare dependencies |
ImageSegmenterSINet.CreateAsync() |
Create segmenter instance |
SegmentImage(Bitmap) |
Perform segmentation |
result.CreateMaskOverlay(Bitmap, Color?) |
Visualize segmentation on original image |
result.ExtractForeground(Bitmap) |
Extract foreground with transparency |
License
MIT License - see LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows10.0.19041 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0-windows10.0.19041
- Contoso.AI.AIFeatureCore (>= 0.0.1-beta)
- Microsoft.WindowsAppSDK (>= 1.8.251106002)
- System.Drawing.Common (>= 8.0.0)
- System.Numerics.Tensors (>= 9.0.9)
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 |
|---|---|---|
| 0.1.6-beta | 46 | 2/5/2026 |
| 0.1.1-beta | 46 | 2/4/2026 |
| 0.1.0-beta | 42 | 2/4/2026 |