Skip to content

Commit e885e5c

Browse files
committed
Upgrade to NatML 1.1.3
1 parent 9a86c23 commit e885e5c

File tree

11 files changed

+464
-449
lines changed

11 files changed

+464
-449
lines changed

Assembly-CSharp.csproj

Lines changed: 46 additions & 55 deletions
Large diffs are not rendered by default.

Assets/MeetSample.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,12 @@ public class MeetSample : MonoBehaviour {
1919
public RawImage rawImage;
2020
public AspectRatioFitter aspectFitter;
2121

22-
private MLEdgeModel model;
2322
private MeetPredictor predictor;
2423
private RenderTexture matteTexture;
2524

2625
private async void Start () {
27-
// Create the model
28-
model = await MLEdgeModel.Create("@natml/meet");
2926
// Create the Meet predictor
30-
predictor = new MeetPredictor(model);
27+
predictor = await MeetPredictor.Create();
3128
// Listen for camera frames
3229
cameraManager.OnCameraFrame.AddListener(OnCameraFrame);
3330
}
@@ -46,8 +43,8 @@ private void OnCameraFrame (CameraFrame frame) {
4643
private void OnDisable () {
4744
// Stop listening for camera frames
4845
cameraManager.OnCameraFrame.RemoveListener(OnCameraFrame);
49-
// Dispose model
50-
model?.Dispose();
46+
// Dispose the predictor
47+
predictor?.Dispose();
5148
}
5249
}
5350
}

Meet.sln

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

22
Microsoft Visual Studio Solution File, Format Version 11.00
33
# Visual Studio 2010
4-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{c2615aae-652d-c31d-d1f1-b6af6ca8093c}"
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{ffe606d5-6412-a6f8-bc3c-8d4b86472400}"
55
EndProject
66
Global
77
GlobalSection(SolutionConfigurationPlatforms) = preSolution
88
Debug|Any CPU = Debug|Any CPU
99
EndGlobalSection
1010
GlobalSection(ProjectConfigurationPlatforms) = postSolution
11-
{c2615aae-652d-c31d-d1f1-b6af6ca8093c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
12-
{c2615aae-652d-c31d-d1f1-b6af6ca8093c}.Debug|Any CPU.Build.0 = Debug|Any CPU
11+
{ffe606d5-6412-a6f8-bc3c-8d4b86472400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
12+
{ffe606d5-6412-a6f8-bc3c-8d4b86472400}.Debug|Any CPU.Build.0 = Debug|Any CPU
1313
EndGlobalSection
1414
GlobalSection(SolutionProperties) = preSolution
1515
HideSolutionNode = FALSE

Packages/ai.natml.vision.meet/Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.0.5
2+
+ Upgraded to NatML 1.1.3.
3+
14
## 1.0.4
25
+ Upgraded to NatML 1.1.
36

Packages/ai.natml.vision.meet/Runtime/MeetPredictor.cs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace NatML.Vision {
77

88
using System;
9+
using System.Threading.Tasks;
910
using NatML.Features;
1011
using NatML.Internal;
1112
using NatML.Types;
@@ -16,25 +17,18 @@ namespace NatML.Vision {
1617
public sealed partial class MeetPredictor : IMLPredictor<MeetPredictor.Matte> {
1718

1819
#region --Client API--
19-
/// <summary>
20-
/// Create the meet predictor.
21-
/// </summary>
22-
/// <param name="model">Meet model.</param>
23-
public MeetPredictor (MLEdgeModel model) => this.model = model as MLEdgeModel;
24-
2520
/// <summary>
2621
/// Segment a person in an image.
2722
/// </summary>
2823
/// <param name="inputs">Input image.</param>
2924
/// <returns>Human matte.</returns>
3025
public Matte Predict (params MLFeature[] inputs) {
31-
// Check
32-
if (inputs.Length != 1)
33-
throw new ArgumentException(@"Meet predictor expects a single feature", nameof(inputs));
34-
// Check type
26+
// Pre-process
3527
var input = inputs[0];
36-
if (!MLImageType.FromType(input.type))
37-
throw new ArgumentException(@"Meet predictor expects an an array or image feature", nameof(inputs));
28+
if (input is MLImageFeature imageFeature) {
29+
(imageFeature.mean, imageFeature.std) = model.normalization;
30+
imageFeature.aspectMode = model.aspectMode;
31+
}
3832
// Predict
3933
using var inputFeature = (input as IMLEdgeFeature).Create(model.inputs[0]);
4034
using var outputFeatures = model.Predict(inputFeature);
@@ -44,13 +38,32 @@ public Matte Predict (params MLFeature[] inputs) {
4438
// Return
4539
return result;
4640
}
41+
42+
/// <summary>
43+
/// Dispose the model and release resources.
44+
/// </summary>
45+
public void Dispose () => model.Dispose();
46+
47+
/// <summary>
48+
/// Create the Meet predictor.
49+
/// </summary>
50+
/// <param name="configuration">Edge model configuration.</param>
51+
/// <param name-"accessKey">NatML access key.</param>
52+
public static async Task<MeetPredictor> Create (
53+
MLEdgeModel.Configuration configuration = null,
54+
string accessKey = null
55+
) {
56+
var model = await MLEdgeModel.Create("@natml/meet", configuration, accessKey);
57+
var predictor = new MeetPredictor(model);
58+
return predictor;
59+
}
4760
#endregion
4861

4962

5063
#region --Operations--
5164
private readonly MLEdgeModel model;
5265

53-
void IDisposable.Dispose () { }
66+
private MeetPredictor (MLEdgeModel model) => this.model = model as MLEdgeModel;
5467
#endregion
5568
}
5669
}

Packages/ai.natml.vision.meet/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "ai.natml.vision.meet",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"displayName": "Meet",
55
"description": "MediaPipe Meet Segmentation for human matting in Unity Engine.",
66
"unity": "2021.2",
77
"dependencies": {
8-
"ai.natml.natml": "1.1.0"
8+
"ai.natml.natml": "1.1.3"
99
},
1010
"keywords": [
1111
"natml",

Packages/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010
],
1111
"dependencies": {
12-
"ai.natml.videokit": "0.0.9",
12+
"ai.natml.videokit": "0.0.11",
1313
"com.unity.collab-proxy": "1.17.7",
1414
"com.unity.feature.development": "1.0.1",
1515
"com.unity.ide.rider": "3.0.18",

Packages/packages-lock.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@
88
"url": "https://registry.npmjs.com"
99
},
1010
"ai.natml.natcorder": {
11-
"version": "1.9.3",
11+
"version": "1.9.4",
1212
"depth": 1,
1313
"source": "registry",
1414
"dependencies": {
15-
"ai.natml.hub": "1.0.15"
15+
"ai.natml.hub": "1.0.20"
1616
},
1717
"url": "https://registry.npmjs.com"
1818
},
1919
"ai.natml.natdevice": {
20-
"version": "1.3.2",
20+
"version": "1.3.3",
2121
"depth": 1,
2222
"source": "registry",
2323
"dependencies": {
24-
"ai.natml.hub": "1.0.15"
24+
"ai.natml.hub": "1.0.20"
2525
},
2626
"url": "https://registry.npmjs.com"
2727
},
2828
"ai.natml.natml": {
29-
"version": "1.1.0",
29+
"version": "1.1.3",
3030
"depth": 1,
3131
"source": "registry",
3232
"dependencies": {
@@ -44,14 +44,14 @@
4444
"url": "https://registry.npmjs.com"
4545
},
4646
"ai.natml.videokit": {
47-
"version": "0.0.9",
47+
"version": "0.0.11",
4848
"depth": 0,
4949
"source": "registry",
5050
"dependencies": {
5151
"ai.natml.hub": "1.0.20",
52-
"ai.natml.natml": "1.1.0",
53-
"ai.natml.natcorder": "1.9.3",
54-
"ai.natml.natdevice": "1.3.2",
52+
"ai.natml.natml": "1.1.3",
53+
"ai.natml.natcorder": "1.9.4",
54+
"ai.natml.natdevice": "1.3.3",
5555
"ai.natml.natshare": "1.3.0"
5656
},
5757
"url": "https://registry.npmjs.com"
@@ -61,7 +61,7 @@
6161
"depth": 0,
6262
"source": "embedded",
6363
"dependencies": {
64-
"ai.natml.natml": "1.1.0"
64+
"ai.natml.natml": "1.1.3"
6565
}
6666
},
6767
"com.unity.collab-proxy": {

ProjectSettings/ProjectSettings.asset

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ PlayerSettings:
150150
- {fileID: 0}
151151
- {fileID: 0}
152152
- {fileID: 0}
153+
- {fileID: 0}
154+
- {fileID: 0}
155+
- {fileID: 0}
153156
metroInputSource: 0
154157
wsaTransparentSwapchain: 0
155158
m_HolographicPauseOnTrackingLoss: 1
@@ -491,6 +494,7 @@ PlayerSettings:
491494
- m_BuildTarget: WebGL
492495
m_StaticBatching: 0
493496
m_DynamicBatching: 0
497+
m_BuildTargetShaderSettings: []
494498
m_BuildTargetGraphicsJobs:
495499
- m_BuildTarget: MacStandaloneSupport
496500
m_GraphicsJobs: 0
@@ -542,6 +546,8 @@ PlayerSettings:
542546
m_Devices:
543547
- Oculus
544548
- OpenVR
549+
m_DefaultShaderChunkSizeInMB: 16
550+
m_DefaultShaderChunkCount: 0
545551
openGLRequireES31: 0
546552
openGLRequireES31AEP: 0
547553
openGLRequireES32: 0
@@ -716,6 +722,7 @@ PlayerSettings:
716722
switchNetworkInterfaceManagerInitializeEnabled: 1
717723
switchPlayerConnectionEnabled: 1
718724
switchUseNewStyleFilepaths: 0
725+
switchUseLegacyFmodPriorities: 1
719726
switchUseMicroSleepForYield: 1
720727
switchEnableRamDiskSupport: 0
721728
switchMicroSleepForYieldTime: 25
@@ -790,6 +797,7 @@ PlayerSettings:
790797
ps4videoRecordingFeaturesUsed: 0
791798
ps4contentSearchFeaturesUsed: 0
792799
ps4CompatibilityPS5: 0
800+
ps4AllowPS5Detection: 0
793801
ps4GPU800MHz: 1
794802
ps4attribEyeToEyeDistanceSettingVR: 0
795803
ps4IncludedModules: []
@@ -814,6 +822,7 @@ PlayerSettings:
814822
webGLLinkerTarget: 1
815823
webGLThreadsSupport: 0
816824
webGLDecompressionFallback: 0
825+
webGLPowerPreference: 2
817826
scriptingDefineSymbols: {}
818827
additionalCompilerArguments: {}
819828
platformArchitecture: {}
@@ -825,6 +834,7 @@ PlayerSettings:
825834
allowUnsafeCode: 0
826835
useDeterministicCompilation: 1
827836
enableRoslynAnalyzers: 1
837+
selectedPlatform: 4
828838
additionalIl2CppArgs:
829839
scriptingRuntimeVersion: 1
830840
gcIncremental: 1
@@ -903,6 +913,7 @@ PlayerSettings:
903913
m_VersionName:
904914
apiCompatibilityLevel: 6
905915
activeInputHandler: 0
916+
windowsGamepadBackendHint: 0
906917
cloudProjectId:
907918
framebufferDepthMemorylessMode: 0
908919
qualitySettingsNames: []

0 commit comments

Comments
 (0)