Skip to content

Instantly share code, notes, and snippets.

@olokobayusuf
Last active October 26, 2021 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olokobayusuf/8b62d18b5b3983f2c3fd3c282ea815bf to your computer and use it in GitHub Desktop.
Save olokobayusuf/8b62d18b5b3983f2c3fd3c282ea815bf to your computer and use it in GitHub Desktop.
Running image classification in Unity with a NatML Hub predictor.
// Fetch the model data from Hub
var modelData = await MLModelData.FromHub("@natsuite/resnet152", accessKey);
// Deserialize the model // The model is actually being created server-side
var model = modelData.Deserialize();
// Create the ResNet classification Hub predictor
var predictor = new ResNetHubPredictor(model);
// Predict
Texture2D image = ...;
var (label, score) = await predictor.Predict(image);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment