TensorStack.Extractors 0.1.18

Prefix Reserved
dotnet add package TensorStack.Extractors --version 0.1.18
                    
NuGet\Install-Package TensorStack.Extractors -Version 0.1.18
                    
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="TensorStack.Extractors" Version="0.1.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TensorStack.Extractors" Version="0.1.18" />
                    
Directory.Packages.props
<PackageReference Include="TensorStack.Extractors" />
                    
Project file
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 TensorStack.Extractors --version 0.1.18
                    
#r "nuget: TensorStack.Extractors, 0.1.18"
                    
#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 TensorStack.Extractors@0.1.18
                    
#: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=TensorStack.Extractors&version=0.1.18
                    
Install as a Cake Addin
#tool nuget:?package=TensorStack.Extractors&version=0.1.18
                    
Install as a Cake Tool

TensorStack.Extractors

High-performance ONNX-based feature extraction for AI workflows. Includes models for edge detection, depth estimation, background removal, and other visual analysis tasks — designed for seamless integration with image and video processing pipelines.

Quick Start

This minimal example demonstrates how to extract depth from image and video using TensorStack.Extractors.

[nuget: TensorStack.Extractors]
[nuget: TensorStack.Providers.DML]
[nuget: TensorStack.Image.Bitmap]
[nuget: TensorStack.Video.Windows]
[nuget: TensorStack.Audio.Windows]
[model: https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/Depth.onnx]

static async Task QuickStartAsync()
{
    // 1. Create the Extractor Pipeline
    var pipeline = ExtractorPipeline.Create(new ExtractorConfig
    {
        IsDynamicOutput = true,
        Normalization = Normalization.OneToOne,
        OutputNormalization = Normalization.MinMaxOneToOne,
        ExecutionProvider = Provider.GetProvider(),
        Path = @"M:\Extractor\Depth.onnx"
    });

    // 2. Extract Depth map from Image
    var inputImage = new ImageInput("Input.png");
    var depthMapImage = await pipeline.RunAsync(new ExtractorImageOptions
    {
        Image = inputImage
    });
    await depthMapImage.SaveAsync("Output.png");

    // 3. Extract Depth map from Video (Streaming mode)
    var inputStream = await VideoInputStream.CreateAsync("Input.mp4");
    var depthMapVideo = pipeline.RunAsync(new ExtractorStreamOptions
    {
            Stream = inputStream.GetAsync()
    });
    await depthMapVideo.SaveAync("Output.mp4");

    // 4. Add audio from the source video (optional)
    await AudioManager.AddAudioAsync("Output.mp4", "Input.mp4");
}

Creating an Extractor Pipeline

[nuget: TensorStack.Extractors]
[nuget: TensorStack.Providers.DML]

// Create the pipeline
var pipeline = ExtractorPipeline.Create(new ExtractorConfig
{
    Normalization = Normalization.ZeroToOne,
    ExecutionProvider = Provider.GetProvider(),
    Path = @"M:\Models\RealESR-General-4x\model.onnx"
});

Configuration Options:

  • Normalization — Input value normalization (ZeroToOne or OneToOne)
  • ExecutionProvider — Hardware provider (CPU, GPU, DirectML, etc.)
  • Path — Path to the ONNX model

Extract Image Features

    [nuget: TensorStack.Image.Bitmap]

    // Read Image
    var inputImage = new ImageInput("Input.png");

    // Extract Image
    var output = await pipeline.RunAsync(new ExtractorImageOptions
    {
        Image = inputImage
    });

    // Write Image
    await output.SaveAsync("Output.png");

Extract Video Features (Buffered)

Buffers all frames in memory. Suitable for short-duration videos, AI-generated content, low-resolution videos, or GIFs.

    [nuget: TensorStack.Video.Windows]

    // Read Video
    var inputVideo = await VideoInput.CreateAsync("Input.gif");

    // Extract Video
    var outputVideo = await pipeline.RunAsync(new ExtractVideoOptions
    {  
        Video = inputVideo
    });

    // Write Video
    await outputVideo.SaveAync("Output.mp4");

Extract Video Features (Stream)

Processes frames one-by-one for minimal memory usage. Ideal for high-resolution or long-duration videos.

    [nuget: TensorStack.Video.Windows]

    // Read Stream
    var inputStream = await VideoInputStream.CreateAsync("Input.mp4");

    // Extract Stream
    var outputStream = pipeline.RunAsync(new ExtractStreamOptions
    {
        Stream = inputStream.GetAsync()
    });

    // Write Stream
    await outputStream.SaveAync("Output.mp4");

Audio Support

TensorStack.Video only processes video frames, so audio will be missing from the final result.

You can use the TensorStack.Audio package to restore audio from the source video:

    [nuget: TensorStack.Audio.Windows]

    await AudioManager.AddAudioAsync("TargetVideo.mp4", "SourceVideo.mp4");

Tiling Support

Tiling allows images and video frames to be processed in smaller sections (tiles) instead of all at once. This helps reduce memory usage and can improve performance when working with very large images or high-resolution videos.

The TileMode determines how these tiles are handled:

  • None: Processes the entire image/frame in a single pass.
  • Overlap: Tiles have overlapping edges to avoid visible seams.
  • Blend: Overlapping tiles are blended together for smooth transitions.
  • Clip: Tiles are cut without blending.
  • Clip + Blend: Combines clipping and blending for high-quality results.

Additional options include:

  • MaxTileSize: The maximum size of each tile in pixels. Smaller tiles reduce memory usage but may take longer to process.
  • TileOverlap: The number of overlapping pixels between tiles. More overlap can prevent visible seams and improve output quality.

Adjusting these settings allows you to balance memory usage, processing speed, and visual quality for your extractor tasks.


Extractor Models

Here is a list of some known and tested models compatible with TensorStack.Extractors:


Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
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
0.1.18 158 10/23/2025
0.1.17 84 10/17/2025
0.1.9 160 10/14/2025