Skip to content

Instantly share code, notes, and snippets.

@olokobayusuf
Created April 24, 2021 20:22
Show Gist options
  • Save olokobayusuf/850551b4b4969d908622fe1c947c2dc1 to your computer and use it in GitHub Desktop.
Save olokobayusuf/850551b4b4969d908622fe1c947c2dc1 to your computer and use it in GitHub Desktop.
Modules which simplify model usage in NatML.
// Create a classifier module
var labels = new [] { "goldfish", "tiger shark", ... };
var classifier = new MLClassifier("/path/to/classifier.onnx", labels);
// Classify an image
Texture2D image = ...;
var (label, confidence) = classifier.Predict(image);
Debug.Log($"Image contains {label} with confidence: {confidence}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment