Skip to content

Commit

Permalink
Add MeetPredictor.Tag
Browse files Browse the repository at this point in the history
  • Loading branch information
lanreolokoba committed Apr 3, 2023
1 parent e885e5c commit f2cc3b0
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 39 deletions.
17 changes: 13 additions & 4 deletions Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_2021_3_17;UNITY_2021_3;UNITY_2021;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;UNITY_INCLUDE_TESTS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_ENGINE_CODE_STRIPPING;ENABLE_MANAGED_UNITYTLS;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;PLATFORM_WEBGL;TEXTCORE_1_0_OR_NEWER;UNITY_WEBGL;UNITY_WEBGL_API;UNITY_DISABLE_WEB_VERIFICATION;UNITY_GFX_USE_PLATFORM_VSYNC;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_SPATIALTRACKING;ENABLE_MONO;NET_STANDARD_2_0;NET_STANDARD;NET_STANDARD_2_1;NETSTANDARD;NETSTANDARD2_1;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;TEXTCORE_FONT_ENGINE_1_5_OR_NEWER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_2021_3_17;UNITY_2021_3;UNITY_2021;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;UNITY_2021_1_OR_NEWER;UNITY_2021_2_OR_NEWER;UNITY_2021_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_NATIVE_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;ENABLE_ACCELERATOR_CLIENT_DEBUGGING;PLATFORM_STANDALONE;TEXTCORE_1_0_OR_NEWER;PLATFORM_STANDALONE_OSX;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_GAMECENTER;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_SPATIALTRACKING;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_STANDARD_2_0;NET_STANDARD;NET_STANDARD_2_1;NETSTANDARD;NETSTANDARD2_1;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;TEXTCORE_FONT_ENGINE_1_5_OR_NEWER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand All @@ -43,6 +43,9 @@
<Reference Include="UnityEngine.AIModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.AIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ARModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.ARModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AccessibilityModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.AccessibilityModule.dll</HintPath>
</Reference>
Expand All @@ -61,6 +64,12 @@
<Reference Include="UnityEngine.ClothModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.ClothModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ClusterInputModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.ClusterInputModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ClusterRendererModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.ClusterRendererModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.CoreModule.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -220,8 +229,8 @@
<Reference Include="UnityEngine.VideoModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.VideoModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.WebGLModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/PlaybackEngines/WebGLSupport/Managed/UnityEngine.WebGLModule.dll</HintPath>
<Reference Include="UnityEngine.VirtualTexturingModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.VirtualTexturingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.WindModule">
<HintPath>/Applications/Unity/Hub/Editor/2021.3.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.WindModule.dll</HintPath>
Expand Down Expand Up @@ -278,7 +287,7 @@
<HintPath>/Users/yusuf/Desktop/meet/Library/PackageCache/com.unity.testtools.codecoverage@1.2.2/lib/ReportGenerator/ReportGeneratorMerged.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>/Users/yusuf/Desktop/meet/Library/PackageCache/com.unity.nuget.newtonsoft-json@3.0.2/Runtime/Newtonsoft.Json.dll</HintPath>
<HintPath>/Users/yusuf/Desktop/meet/Library/PackageCache/com.unity.nuget.newtonsoft-json@3.1.0/Runtime/Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Unity.VisualScripting.Antlr3.Runtime">
<HintPath>/Users/yusuf/Desktop/meet/Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Dependencies/NCalc/Unity.VisualScripting.Antlr3.Runtime.dll</HintPath>
Expand Down
3 changes: 3 additions & 0 deletions Packages/ai.natml.vision.meet/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.6
+ Added `MeetPredictor.Tag` constant string for enabling edge model embedding.

## 1.0.5
+ Upgraded to NatML 1.1.3.

Expand Down
13 changes: 6 additions & 7 deletions Packages/ai.natml.vision.meet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@ Add the following items to your Unity project's `Packages/manifest.json`:
}
],
"dependencies": {
"ai.natml.vision.meet": "1.0.4"
"ai.natml.vision.meet": "1.0.6"
}
}
```

## Predicting the Matte
First, create the predictor:
```csharp
// Create the model
var model = await MLEdgeModel.Create("@natml/meet");
// Create the Meet predictor
var predictor = new MeetPredictor(model);
var predictor = await MeetPredictor.Create();
```

Then predict the human matte:
Expand All @@ -37,8 +35,9 @@ MeetPredictor.Matte matte = predictor.Predict(image);

Finally, render the segmentation map to a `RenderTexture`:
```csharp
// Visualize the map into a `RenderTexture`
// Create a destination `RenderTexture`
var result = new RenderTexture(image.width, image.height, 0);
// Visualize the map into a `RenderTexture`
matte.Render(result);
```

Expand All @@ -48,9 +47,9 @@ ___
- Unity 2021.2+

## Quick Tips
- Discover more ML models on [NatML Hub](https://hub.natml.ai).
- See the [NatML documentation](https://docs.natml.ai/natml).
- Join the [NatML community on Discord](https://natml.ai/community).
- Discover more ML models on [NatML Hub](https://hub.natml.ai).
- See the [NatML documentation](https://docs.natml.ai/unity).
- Contact us at [hi@natml.ai](mailto:hi@natml.ai).

Thank you very much!
7 changes: 6 additions & 1 deletion Packages/ai.natml.vision.meet/Runtime/MeetPredictor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ namespace NatML.Vision {
public sealed partial class MeetPredictor : IMLPredictor<MeetPredictor.Matte> {

#region --Client API--
/// <summary>
/// Predictor tag.
/// </summary>
public const string Tag = "@natml/meet";

/// <summary>
/// Segment a person in an image.
/// </summary>
Expand Down Expand Up @@ -53,7 +58,7 @@ public static async Task<MeetPredictor> Create (
MLEdgeModel.Configuration configuration = null,
string accessKey = null
) {
var model = await MLEdgeModel.Create("@natml/meet", configuration, accessKey);
var model = await MLEdgeModel.Create(Tag, configuration, accessKey);
var predictor = new MeetPredictor(model);
return predictor;
}
Expand Down
6 changes: 3 additions & 3 deletions Packages/ai.natml.vision.meet/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "ai.natml.vision.meet",
"version": "1.0.5",
"version": "1.0.6",
"displayName": "Meet",
"description": "MediaPipe Meet Segmentation for human matting in Unity Engine.",
"unity": "2021.2",
"dependencies": {
"ai.natml.natml": "1.1.3"
"ai.natml.natml": "1.1.4"
},
"keywords": [
"natml",
Expand All @@ -24,5 +24,5 @@
"url": "https://github.com/natmlx"
},
"license": "Apache-2.0",
"repository": "github:natml-hub/Meet"
"repository": "github:natmlx/meet-unity"
}
9 changes: 5 additions & 4 deletions Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
"url": "https://registry.npmjs.com"
},
"ai.natml.natml": {
"version": "1.1.3",
"version": "1.1.4",
"depth": 1,
"source": "registry",
"dependencies": {
"ai.natml.hub": "1.0.20"
"ai.natml.hub": "1.0.20",
"com.unity.nuget.newtonsoft-json": "3.1.0"
},
"url": "https://registry.npmjs.com"
},
Expand Down Expand Up @@ -61,7 +62,7 @@
"depth": 0,
"source": "embedded",
"dependencies": {
"ai.natml.natml": "1.1.3"
"ai.natml.natml": "1.1.4"
}
},
"com.unity.collab-proxy": {
Expand Down Expand Up @@ -127,7 +128,7 @@
"url": "https://packages.unity.com"
},
"com.unity.nuget.newtonsoft-json": {
"version": "3.0.2",
"version": "3.1.0",
"depth": 2,
"source": "registry",
"dependencies": {},
Expand Down
40 changes: 20 additions & 20 deletions UserSettings/Layouts/default-2021.dwlt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ MonoBehaviour:
m_MinSize: {x: 400, y: 200}
m_MaxSize: {x: 32384, y: 16192}
vertical: 0
controlID: 291
controlID: 101
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
Expand Down Expand Up @@ -198,7 +198,7 @@ MonoBehaviour:
m_MinSize: {x: 100, y: 200}
m_MaxSize: {x: 8096, y: 16192}
vertical: 1
controlID: 252
controlID: 72
--- !u!114 &9
MonoBehaviour:
m_ObjectHideFlags: 52
Expand All @@ -218,8 +218,8 @@ MonoBehaviour:
y: 0
width: 321.5
height: 327.5
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 15}
m_Panes:
- {fileID: 15}
Expand Down Expand Up @@ -271,8 +271,8 @@ MonoBehaviour:
y: 0
width: 317
height: 745
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 18}
m_Panes:
- {fileID: 18}
Expand All @@ -295,7 +295,7 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Project Settings
m_Image: {fileID: 866346219090771560, guid: 0000000000000000d000000000000000, type: 0}
m_Image: {fileID: -5712115415447495865, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
Expand Down Expand Up @@ -350,7 +350,7 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Scene
m_Image: {fileID: 8634526014445323508, guid: 0000000000000000d000000000000000, type: 0}
m_Image: {fileID: 2593428753322112591, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
Expand Down Expand Up @@ -655,7 +655,7 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Game
m_Image: {fileID: 4621777727084837110, guid: 0000000000000000d000000000000000, type: 0}
m_Image: {fileID: -6423792434712278376, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
Expand Down Expand Up @@ -747,7 +747,7 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Hierarchy
m_Image: {fileID: -3734745235275155857, guid: 0000000000000000d000000000000000, type: 0}
m_Image: {fileID: 7966133145522015247, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
Expand All @@ -762,9 +762,9 @@ MonoBehaviour:
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: b65b0000
m_LastClickedID: 23478
m_ExpandedIDs: 18faffff28fbffff2afbffff
m_SelectedIDs: 86850000
m_LastClickedID: 34182
m_ExpandedIDs: 26cfffff3ad0ffff
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand Down Expand Up @@ -804,7 +804,7 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Console
m_Image: {fileID: -4950941429401207979, guid: 0000000000000000d000000000000000, type: 0}
m_Image: {fileID: -4327648978806127646, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
Expand Down Expand Up @@ -832,7 +832,7 @@ MonoBehaviour:
m_MaxSize: {x: 10000, y: 10000}
m_TitleContent:
m_Text: Project
m_Image: {fileID: -5179483145760003458, guid: 0000000000000000d000000000000000, type: 0}
m_Image: {fileID: -5467254957812901981, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
Expand Down Expand Up @@ -870,9 +870,9 @@ MonoBehaviour:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 105c0000
m_LastClickedID: 23568
m_ExpandedIDs: 00000000105c000000ca9a3bffffff7f
m_SelectedIDs: 38850000
m_LastClickedID: 34104
m_ExpandedIDs: 000000003885000000ca9a3bffffff7f
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand Down Expand Up @@ -900,7 +900,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 00000000105c0000
m_ExpandedIDs:
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand All @@ -927,7 +927,7 @@ MonoBehaviour:
m_ListAreaState:
m_SelectedInstanceIDs:
m_LastClickedInstanceID: 0
m_HadKeyboardFocusLastEvent: 0
m_HadKeyboardFocusLastEvent: 1
m_ExpandedInstanceIDs: c6230000
m_RenameOverlay:
m_UserAcceptedRename: 0
Expand Down

0 comments on commit f2cc3b0

Please sign in to comment.