Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using System;
using System.IO;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using lobe.ImageSharp;
using lobe;
namespace ConsoleApp1
class Program
static void Main(string[] args)
var signatureFilePath = "signature.json";
ImageClassifier.Register("onnx", () => new OnnxImageClassifier());
using var classifier = ImageClassifier.CreateFromSignatureFile(
new FileInfo(signatureFilePath));
// Images
ShowResults("fishy.png", classifier);
ShowResults("human.png", classifier);
private static void ShowResults(string imagePath, ImageClassifier classifier)
var results = classifier.Classify(Image
Console.WriteLine($"Image : {imagePath}");
Console.WriteLine($"Top Label: {results.Classification.Label}");
foreach (var res in results.Classifications)
Console.WriteLine($" - Label: {res.Label} - Confidence: {res.Confidence}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment