OnnxStack.Core
0.3.0
Prefix Reserved
See the version list below for details.
dotnet add package OnnxStack.Core --version 0.3.0
NuGet\Install-Package OnnxStack.Core -Version 0.3.0
<PackageReference Include="OnnxStack.Core" Version="0.3.0" />
paket add OnnxStack.Core --version 0.3.0
#r "nuget: OnnxStack.Core, 0.3.0"
// Install OnnxStack.Core as a Cake Addin #addin nuget:?package=OnnxStack.Core&version=0.3.0 // Install OnnxStack.Core as a Cake Tool #tool nuget:?package=OnnxStack.Core&version=0.3.0
<p align="center" width="100%"> <img width="80%" src="Assets/OnnxStack - 640x320.png"> </p>
Welcome to OnnxStack!
OnnxStack is a library that provides higher-level services and integrations for .NET applications, enhancing the functionality and versatility of the ONNX Runtime
and Microsoft ML
projects, offering a comprehensive solution that empowers developers to build, deploy, and execute machine learning models seamlessly in .NET environments, unlocking a world of possibilities for intelligent applications.
Projects
OnnxStack.StableDiffusion
Inference Stable Diffusion with C# and ONNX Runtime
Prompt
Stable Diffusion models take a text prompt and create an image that represents the text.
Example:
High-fashion photography in an abandoned industrial warehouse, with dramatic lighting and edgy outfits, detailed clothing, intricate clothing, seductive pose, action pose, motion, beautiful digital artwork, atmospheric, warm sunlight, photography, neo noir, bokeh, beautiful dramatic lighting, shallow depth of field, photorealism, volumetric lighting, Ultra HD, raytracing, studio quality, octane render
Negative Prompt
A negative prompt can be provided to guide the inference to exclude in calculations
Example:
painting, drawing, sketches, monochrome, grayscale, illustration, anime, cartoon, graphic, text, crayon, graphite, abstract, easynegative, low quality, normal quality, worst quality, lowres, close up, cropped, out of frame, jpeg artifacts, duplicate, morbid, mutilated, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, glitch, deformed, mutated, cross-eyed, ugly, dehydrated, bad anatomy, bad proportions, gross proportions, cloned face, disfigured, malformed limbs, missing arms, missing legs fused fingers, too many fingers,extra fingers, extra limbs,, extra arms, extra legs,disfigured,
Schedulers
Many different scheduler algorithms can be used for this computation, each having its pro- and cons.
So far OnnxStack.StableDiffusion
as included LMS Discrete
, Euler Ancestral
and DDPM
options with more in the works.
Example: | LMS Scheduler | Euler Ancestral Scheduler | DDPM Scheduler | | :--- | :--- | :--- | <img src="Assets/Samples/624461087_22_8_LMSScheduler.png" width="256" alt="Image of browser inferencing on sample images."/> | <img src="Assets/Samples/624461087_22_8_EulerAncestralScheduler.png" width="256" alt="Image of browser inferencing on sample images."/> |<img src="Assets/Samples/624461087_22_8_DDPMScheduler.png" width="256" alt="Image of browser inferencing on sample images."/> |
Seed: 624461087 GuidanceScale: 8 NumInferenceSteps: 22
Text To Image
Text To Image Stable Diffusion is a powerful machine learning technique that allows you to generate high-quality images from textual descriptions. It combines the capabilities of text understanding and image synthesis to convert natural language descriptions into visually coherent and meaningful images
Input Text | Output Image | Diffusion Steps |
---|---|---|
<img src="Assets/Samples/Text2Img_Start.png" width="256" alt="Image of browser inferencing on sample images."/> | <img src="Assets/Samples/Text2Img_End.png" width="256" alt="Image of browser inferencing on sample images."/> | <img src="Assets/Samples/Text2Img_Animation.webp" width="256" alt="Image of browser inferencing on sample images."/> |
Image To Image
Image To Image Stable Diffusion is an advanced image processing and generation method that excels in transforming one image into another while preserving the visual quality and structure of the original content. Using stable diffusion, this technique can perform a wide range of image-to-image tasks, such as style transfer, super-resolution, colorization, and more
Input Image | Output Image | Diffusion Steps |
---|---|---|
<img src="Assets/Samples/Img2Img_Start.bmp" width="256" alt="Image of browser inferencing on sample images."/> | <img src="Assets/Samples/Img2Img_End.png" width="256" alt="Image of browser inferencing on sample images."/> | <img src="Assets/Samples/Img2Img_Animation.webp" width="256" alt="Image of browser inferencing on sample images."/> |
Prompt: Dog wearing storm trooper helmet, head shot
More information and Examples can be found in the OnnxStack.StableDiffusion
project README
OnnxStack.ImageRecognition
Image recognition with ResNet50v2 and ONNX Runtime
Harness the accuracy of the ResNet50v2 deep learning model for image recognition, seamlessly integrated with ONNX for efficient deployment. This combination empowers your applications to classify images with precision, making it ideal for tasks like object detection, content filtering, and image tagging across various platforms and hardware accelerators. Achieve high-quality image recognition effortlessly with ResNet50v2 and ONNX integration.
work in progress
OnnxStack.ObjectDetection
Object detection with Faster RCNN Deep Learning with C# and ONNX Runtime
Enable robust object detection in your applications using RCNN (Region-based Convolutional Neural Network) integrated with ONNX. This powerful combination allows you to accurately locate and classify objects within images. Whether for surveillance, autonomous vehicles, or content analysis, RCNN and ONNX integration offers efficient and precise object detection across various platforms and hardware, ensuring your solutions excel in recognizing and localizing objects in images.
work in progress
Getting Started
ONNX Model Download
You will need an ONNX compatible model to use, Hugging Face is a great place to download the Stable Diffusion models
Download the ONNX Stable Diffusion models from Hugging Face.
Once you have selected a model version repo, click Files and Versions
, then select the ONNX
branch. If there isn't an ONNX model branch available, use the main
branch and convert it to ONNX. See the ONNX conversion tutorial for PyTorch for more information.
Clone the model repo:
git lfs install
git clone https://huggingface.co/runwayml/stable-diffusion-v1-5 -b onnx
Hardware Requirements
You can choose between Cpu
and DirectML
(GPU) for inference,
Other Microsoft.ML.OnnxRuntime.*
executors like Cuda
may work but are untested
Cpu
> 12GB RAM
DirectML
> 10GB VRAM
Contribution
We welcome contributions to OnnxStack! If you have any ideas, bug reports, or improvements, feel free to open an issue or submit a pull request.
Resources
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 7.0.0)
- Microsoft.ML (>= 2.0.1)
- Microsoft.ML.OnnxRuntime.Extensions (>= 0.9.0)
- Microsoft.ML.OnnxRuntime.Managed (>= 1.16.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on OnnxStack.Core:
Package | Downloads |
---|---|
OnnxStack.StableDiffusion
Stable Diffusion Library for .NET |
|
OnnxStack.ImageUpscaler
OnnxRuntime Image Upscale Library for .NET |
|
OnnxStack.FeatureExtractor
OnnxRuntime Image Feature Extractor Library for .NET |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on OnnxStack.Core:
Repository | Stars |
---|---|
TensorStack-AI/OnnxStack
C# Stable Diffusion using ONNX Runtime
|
Version | Downloads | Last updated | |
---|---|---|---|
0.39.0 | 393 | 6/12/2024 | |
0.31.0 | 269 | 4/25/2024 | |
0.27.0 | 193 | 3/31/2024 | |
0.25.0 | 179 | 3/14/2024 | |
0.23.0 | 175 | 2/29/2024 | |
0.22.0 | 135 | 2/23/2024 | |
0.21.0 | 157 | 2/15/2024 | |
0.19.0 | 163 | 2/1/2024 | |
0.17.0 | 184 | 1/18/2024 | |
0.16.0 | 134 | 1/11/2024 | |
0.15.0 | 205 | 1/5/2024 | |
0.14.0 | 163 | 12/27/2023 | |
0.13.0 | 133 | 12/22/2023 | |
0.12.0 | 143 | 12/15/2023 | |
0.10.0 | 168 | 11/30/2023 | |
0.9.0 | 148 | 11/23/2023 | |
0.8.0 | 202 | 11/16/2023 | |
0.7.0 | 147 | 11/9/2023 | |
0.6.0 | 133 | 11/2/2023 | |
0.5.0 | 140 | 10/27/2023 | |
0.4.0 | 121 | 10/19/2023 | |
0.3.1 | 148 | 10/9/2023 | |
0.3.0 | 117 | 10/9/2023 | |
0.2.0 | 124 | 10/3/2023 | |
0.1.0 | 171 | 9/25/2023 |