• Stars
    star
    224
  • Rank 176,979 (Top 4 %)
  • Language
    C#
  • License
    Apache License 2.0
  • Created about 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

High performance, cross-platform machine learning for Unity Engine. Register at https://hub.natml.ai

NatML

NatML

NatML allows developers to integrate machine learning into their Unity applications in under five lines of code with zero infrastructure. NatML completely removes the need to have any experience with machine learning in order to take advantage of the features it can provide. Features include:

  • Universal Machine Learning. With NatML, you can drop CoreML (.mlmodel), TensorFlow Lite (.tflite), 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, WebGL, and Windows alike. As a result, you can build your app once, test it in the Editor, and deploy it various platforms and devices 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.

  • Lightweight Package. NatML is distributed in a self-contained package, with no external dependencies. As a result, you can simply import the package and get going--no setup necessary.

Installing NatML

Add the following items to your Unity project's Packages/manifest.json:

{
  "scopedRegistries": [
    {
      "name": "NatML",
      "url": "https://registry.npmjs.com",
      "scopes": ["ai.natml"]
    }
  ],
  "dependencies": {
    "ai.natml.natml": "1.1.15"
  }
}

Using ML Models

drag and drop

If you have a CoreML, ONNX, or TensorFlow Lite model, you can simply drag and drop it into your project. See the documentation for more details.

Note that specific model formats can only be used on specific platforms. CoreML models can only be used on iOS and macOS; ONNX can only be used on Windows; and TensorFlow Lite can only be used on Android. Use NatML Hub to convert your model to different ML formats.

Discover ML Models on NatML Hub

Create an account on NatML Hub to find and download ML predictors to use in your project!

NatML Hub

You can also upload your models to Hub and make them private or public. Check out the documentation for information on writing predictors for your models.

Using ML Models in Two Simple Steps

You will always use NatML in two steps. First, create a predictor by fetching model data from NatML Hub or by loading a local ML model file in your project (.mlmodel, .tflite, and .onnx):

// Create the MobileNet v2 predictor
var predictor = await MobileNetv2Predictor.Create();

Then make predictions with the predictor:

// Make prediction on an image
Texture2D image = ...;
var (label, score) = predictor.Predict(image);

Different predictors accept and produce different data types, but the usage pattern will always be the same.


Requirements

  • Unity 2022.3+

Supported Platforms

  • Android API Level 24+
  • iOS 14+
  • macOS 10.15+ (Apple Silicon and Intel)
  • Windows 10+ (64-bit only)
  • WebGL:
    • Chrome 91+
    • Firefox 90+
    • Safari 16.4+

Resources

Thank you very much!

More Repositories

1

natshare

Cross-platform social sharing for Unity Engine.
135
star
2

natstep

Cross-platform step counting for Unity Engine.
C#
107
star
3

natcorder

High performance, cross-platform video recording for Unity Engine.
99
star
4

videokit

Low-code, cross-platform media SDK for Unity Engine. Register at https://videokit.ai
C#
77
star
5

NatRender

High performance native graphics utilities for Unity Engine.
C#
31
star
6

robust-video-matting-unity

Robust Video Matting for high-fidelity human segmentation in Unity Engine.
C#
28
star
7

natdevice

High performance, cross-platform media device streaming for Unity Engine.
26
star
8

movenet-3d-unity

MoveNet 3D pose detection sample in Unity Engine.
C#
17
star
9

NatCorder-Performance-Extensions

Performance extensions for video recording in Unity Engine.
C#
17
star
10

movenet-unity

Realtime pose detection in Unity Engine with NatML.
C#
13
star
11

videokit-arfoundation-sample

Record and share augmented reality experiences with Unity ARFoundation and VideoKit.
13
star
12

movenet-multipose-unity

Multiple-person pose detection in Unity Engine.
C#
11
star
13

NatCam-VR-Cardboard

A Google Cardboard VR project using the rear camera preview. Powered by NatCam 1.2.
C#
11
star
14

mobilenet-v2-unity

Realtime image classification in Unity Engine.
C#
11
star
15

Compositor-API

Compositor is a lightweight utility API for compositing images quickly and efficiently in Unity.
C#
11
star
16

nanodet-unity

Anchor-free ultra-fast object detection in Unity Engine.
C#
11
star
17

ml-bench

Benchmarking the NatML machine learning runtime against other solutions in Unity Engine.
C#
8
star
18

blazepose-unity

Pose detection with MediaPipe BlazePose in Unity Engine.
C#
8
star
19

blazeface-unity

Realtime face detection in Unity Engine with NatML and NatDevice.
C#
7
star
20

blazepalm-unity

Hand landmark prediction with MediaPipe Hands in Unity Engine.
C#
7
star
21

meet-unity

MediaPipe selfie segmentation in Unity Engine.
C#
7
star
22

NatMLX

Machine learning extensions for Unity Engine. Register at https://hub.natml.ai
C#
7
star
23

natml-arfoundation

NatML integration library for Unity ARFoundation.
C#
6
star
24

yolox-unity

High performance object detector based on YOLO series.
C#
5
star
25

WebCorder

Record videos from Unity Engine in WebGL.
C#
5
star
26

NatDevice-ZXing-Integration

Example integrating NatDevice API with ZXing.NET for barcode detection.
C#
4
star
27

videokit-opencv-sample

Integrating VideoKit with OpenCV to build computer vision apps.
C#
4
star
28

blazepalm-detector-unity

Palm detection with MediaPipe Hands in Unity Engine.
C#
3
star
29

natml-py

Zero-infrastructure machine learning for Python. Register at https://hub.natml.ai
Python
2
star
30

CSharp

NatML C# and Unity style guide.
1
star
31

blazepose-detector-unity

MediaPipe pose detection in Unity Engine.
C#
1
star
32

camera-slow-motion

Record slow motion camera videos in Unity Engine using VideoKit.
C#
1
star
33

yunet-unity

Ultra-high performance face detection architecture.
C#
1
star
34

centerface-unity

CenterFace anchor-free face detection.
C#
1
star