Skip to content

Latest commit

 

History

History
47 lines (41 loc) · 1.16 KB

File metadata and controls

47 lines (41 loc) · 1.16 KB

MobileNet v2

Realtime object classification machine learning model optimized for mobile applications.

Installing MobileNet v2

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.vision.mobilenet-v2": "1.0.4"
  }
}

Classifying an Image

First, create the MobileNet v2 predictor:

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

Then make predictions on images:

// Given an image...
Texture2D image = ...;
// Classify the image
MobileNetv2Predictor.Label result = predictor.Predict(image);
// Use the result
Debug.Log($"Model predicted {result.label} with confidence {result.confidence}");

Requirements

  • Unity 2022.3+

Quick Tips

Thank you very much!