NatML for Unity
High Performance Cross-Platform Machine Learning

Machine Learning Made Easy

NatML is a cross-platform machine learning runtime for Unity Engine. It allows you to run ML models in your app, opening up possibilities in your user experience. In a few simple steps:
First fetch a model:
// Fetch the MobileNet classifier model data
var modelData = await MLModelData.FromHub("@natsuite/mobilenet-v2");
// Create the model
var model = modelData.Deserialize();
Then create a predictor to make predictions with your model:
// Create a predictor
var labels = new [] { "cat", "dog", ... };
var predictor = new MobileNetv2Predictor(model, labels);
Finally, make predictions with the predictor:
// Say we have an image
Texture2D image = ...;
// We use our model to classify it
var (label, confidence) = predictor.Predict(image);
// Log classification to console
Debug.Log(quot;Model predicted {label} with confidence {confidence}");

Bare Metal Performance

NatML is designed specifically around high-performance interactive applications. Features include:
  • Universal Machine Learning. With NatML, you can drop TensorFlow Lite (.tflite), CoreML (.mlmodel), and ONNX (.onnx) models directly into your Unity project and run them.
  • Bare Metal Performance. NatML takes advantage of hardware machine learning accelerators, like CoreML on iOS and macOS, NNAPI on Android, and DirectML on Windows. As a result, it is multiple times faster than Unity's own Barracuda engine.
  • Cross Platform. NatML supports Android, iOS, macOS, and Windows alike. As a result, you can build your app once, test it in the Editor, and deploy it to the device all in one seamless workflow.
  • Extremely Easy to Use. NatML exposes machine learning models with simple classes that return familiar data types. These are called "Predictors", and they handle all of the heavy lifting for you. No need to write pre-processing scripts or shaders, wrangle tensors, or anything of that sort.
  • Growing Catalog. NatML is designed with a singular focus on applications. As such, we maintain a growing catalog of predictors that developers can quickly discover and deploy in their applications. Check out NatML Hub.
  • Computer Vision. NatML supports models for object classification, object detection, semantic segmentation, style transfer, and so much more.
  • Augmented Reality. NatML is particularly suited for augmented reality because it delegates work to ML accelerators, freeing up the GPU to render your app smoothly.
  • Lightweight Package. NatML is distributed in a self-contained package, with no external dependencies and no setup necessary.

Get NatML

GitHub - natsuite/NatML: High performance, cross-platform machine learning for Unity Engine. Register at
NatML on GitHub