Skip to content

Commit fee6237

Browse files
committed
Bump to NatML 1.1.16
1 parent 83eb239 commit fee6237

24 files changed

+1962
-594
lines changed

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ Logs/
99
.gradle/
1010
.vs/
1111

12+
# Function
13+
ProjectSettings/Function.asset
14+
1215
# NatML
13-
Assets/NatML
14-
Assets/NatML.meta
16+
ProjectSettings/NatML.asset
1517
ProjectSettings/NatMLHub.asset
1618

17-
# ARFoundation Remote
18-
ARFoundationRemoteInstaller
19-
ARFoundationRemoteCompanionApp/
19+
# VideoKit
20+
ProjectSettings/VideoKit.asset
2021

2122
# Misc
2223
.DS_Store

Assembly-CSharp.csproj

Lines changed: 305 additions & 301 deletions
Large diffs are not rendered by default.

Assets/BlazePoseDetectorSample.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
22
* BlazePose Detector
3-
* Copyright (c) 2022 NatML Inc. All Rights Reserved.
3+
* Copyright (c) 2023 NatML Inc. All Rights Reserved.
44
*/
55

66
namespace NatML.Examples {
77

88
using UnityEngine;
9-
using NatML.VideoKit;
109
using NatML.Vision;
10+
using VideoKit;
1111
using Visualizers;
1212

1313
public sealed class BlazePoseDetectorSample : MonoBehaviour {
@@ -18,36 +18,27 @@ public sealed class BlazePoseDetectorSample : MonoBehaviour {
1818
[Header(@"UI")]
1919
public DetectionVisualizer visualizer;
2020

21-
private MLModelData modelData;
22-
private MLModel model;
2321
private BlazePoseDetector predictor;
2422

2523
private async void Start () {
26-
// Fetch the model data from NatML
27-
modelData = await MLModelData.FromHub("@natml/blazepose-detector");
28-
// Create the model
29-
model = new MLEdgeModel(modelData);
30-
// Create the BlazePose detector
31-
predictor = new BlazePoseDetector(model);
24+
// Create predictor
25+
predictor = await BlazePoseDetector.Create();
3226
// Listen for camera frames
33-
cameraManager.OnFrame.AddListener(OnCameraFrame);
27+
cameraManager.OnCameraFrame.AddListener(OnCameraFrame);
3428
}
3529

3630
private void OnCameraFrame (CameraFrame frame) {
3731
// Create image feature
38-
var feature = frame.feature;
39-
(feature.mean, feature.std) = modelData.normalization;
40-
feature.aspectMode = modelData.aspectMode;
41-
var detections = predictor.Predict(feature);
32+
var detections = predictor.Predict(frame);
4233
// Visualize detections
4334
visualizer.Render(detections);
4435
}
4536

4637
private void OnDisable () {
4738
// Stop listening for camera frames
48-
cameraManager.OnFrame.RemoveListener(OnCameraFrame);
39+
cameraManager.OnCameraFrame.RemoveListener(OnCameraFrame);
4940
// Dispose the model
50-
model?.Dispose();
41+
predictor?.Dispose();
5142
}
5243
}
5344
}

Assets/BlazePoseDetectorSample.unity

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 705507994}
41-
m_IndirectSpecularColor: {r: 0.44657838, g: 0.49641234, b: 0.57481676, a: 1}
41+
m_IndirectSpecularColor: {r: 0.44407493, g: 0.49331808, b: 0.5724013, a: 1}
4242
m_UseRadianceAmbientProbe: 0
4343
--- !u!157 &3
4444
LightmapSettings:
@@ -104,7 +104,7 @@ NavMeshSettings:
104104
serializedVersion: 2
105105
m_ObjectHideFlags: 0
106106
m_BuildSettings:
107-
serializedVersion: 2
107+
serializedVersion: 3
108108
agentTypeID: 0
109109
agentRadius: 0.5
110110
agentHeight: 2
@@ -117,7 +117,7 @@ NavMeshSettings:
117117
cellSize: 0.16666667
118118
manualTileSize: 0
119119
tileSize: 256
120-
accuratePlacement: 0
120+
buildHeightMesh: 0
121121
maxJobWorkers: 0
122122
preserveTilesOutsideBounds: 0
123123
debug:
@@ -199,7 +199,9 @@ Canvas:
199199
m_OverrideSorting: 0
200200
m_OverridePixelPerfect: 0
201201
m_SortingBucketNormalizedSize: 0
202+
m_VertexColorAlwaysGammaSpace: 0
202203
m_AdditionalShaderChannelsFlag: 0
204+
m_UpdateRectTransformForStandalone: 0
203205
m_SortingLayerID: 0
204206
m_SortingOrder: 0
205207
m_TargetDisplay: 0
@@ -218,7 +220,6 @@ RectTransform:
218220
- {fileID: 1777274299}
219221
- {fileID: 1337286983}
220222
m_Father: {fileID: 0}
221-
m_RootOrder: 2
222223
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
223224
m_AnchorMin: {x: 0, y: 0}
224225
m_AnchorMax: {x: 0, y: 0}
@@ -311,13 +312,13 @@ Transform:
311312
m_PrefabInstance: {fileID: 0}
312313
m_PrefabAsset: {fileID: 0}
313314
m_GameObject: {fileID: 705507993}
315+
serializedVersion: 2
314316
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
315317
m_LocalPosition: {x: 0, y: 3, z: 0}
316318
m_LocalScale: {x: 1, y: 1, z: 1}
317319
m_ConstrainProportionsScale: 0
318320
m_Children: []
319321
m_Father: {fileID: 0}
320-
m_RootOrder: 1
321322
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
322323
--- !u!1 &963194225
323324
GameObject:
@@ -359,9 +360,17 @@ Camera:
359360
m_projectionMatrixMode: 1
360361
m_GateFitMode: 2
361362
m_FOVAxisMode: 0
363+
m_Iso: 200
364+
m_ShutterSpeed: 0.005
365+
m_Aperture: 16
366+
m_FocusDistance: 10
367+
m_FocalLength: 50
368+
m_BladeCount: 5
369+
m_Curvature: {x: 2, y: 11}
370+
m_BarrelClipping: 0.25
371+
m_Anamorphism: 0
362372
m_SensorSize: {x: 36, y: 24}
363373
m_LensShift: {x: 0, y: 0}
364-
m_FocalLength: 50
365374
m_NormalizedViewPortRect:
366375
serializedVersion: 2
367376
x: 0
@@ -395,13 +404,13 @@ Transform:
395404
m_PrefabInstance: {fileID: 0}
396405
m_PrefabAsset: {fileID: 0}
397406
m_GameObject: {fileID: 963194225}
407+
serializedVersion: 2
398408
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
399409
m_LocalPosition: {x: 0, y: 1, z: -10}
400410
m_LocalScale: {x: 1, y: 1, z: 1}
401411
m_ConstrainProportionsScale: 0
402412
m_Children: []
403413
m_Father: {fileID: 0}
404-
m_RootOrder: 0
405414
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
406415
--- !u!1 &1131137043
407416
GameObject:
@@ -428,13 +437,13 @@ Transform:
428437
m_PrefabInstance: {fileID: 0}
429438
m_PrefabAsset: {fileID: 0}
430439
m_GameObject: {fileID: 1131137043}
440+
serializedVersion: 2
431441
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
432442
m_LocalPosition: {x: 0, y: 0, z: 0}
433443
m_LocalScale: {x: 1, y: 1, z: 1}
434444
m_ConstrainProportionsScale: 0
435445
m_Children: []
436446
m_Father: {fileID: 0}
437-
m_RootOrder: 4
438447
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
439448
--- !u!114 &1131137045
440449
MonoBehaviour:
@@ -462,12 +471,14 @@ MonoBehaviour:
462471
m_Script: {fileID: 11500000, guid: 98622613d505143a9a06b4b11b0a82cf, type: 3}
463472
m_Name:
464473
m_EditorClassIdentifier:
465-
resolution: 3
466-
capabilities: 1
474+
capabilities: 2
467475
playOnAwake: 1
476+
_facing: 0
477+
resolution: 3
478+
frameRate: 30
468479
focusMode: 0
469480
exposureMode: 0
470-
OnFrame:
481+
OnCameraFrame:
471482
m_PersistentCalls:
472483
m_Calls: []
473484
--- !u!1 &1232703155
@@ -500,6 +511,7 @@ MonoBehaviour:
500511
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
501512
m_Name:
502513
m_EditorClassIdentifier:
514+
m_SendPointerHoverToParent: 1
503515
m_HorizontalAxis: Horizontal
504516
m_VerticalAxis: Vertical
505517
m_SubmitButton: Submit
@@ -529,13 +541,13 @@ Transform:
529541
m_PrefabInstance: {fileID: 0}
530542
m_PrefabAsset: {fileID: 0}
531543
m_GameObject: {fileID: 1232703155}
544+
serializedVersion: 2
532545
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
533546
m_LocalPosition: {x: 0, y: 0, z: 0}
534547
m_LocalScale: {x: 1, y: 1, z: 1}
535548
m_ConstrainProportionsScale: 0
536549
m_Children: []
537550
m_Father: {fileID: 0}
538-
m_RootOrder: 3
539551
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
540552
--- !u!1 &1337286982
541553
GameObject:
@@ -568,7 +580,6 @@ RectTransform:
568580
m_ConstrainProportionsScale: 0
569581
m_Children: []
570582
m_Father: {fileID: 411086898}
571-
m_RootOrder: 1
572583
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
573584
m_AnchorMin: {x: 0.5, y: 0.5}
574585
m_AnchorMax: {x: 0.5, y: 0.5}
@@ -627,6 +638,7 @@ GameObject:
627638
- component: {fileID: 1777274302}
628639
- component: {fileID: 1777274304}
629640
- component: {fileID: 1777274303}
641+
- component: {fileID: 1777274305}
630642
m_Layer: 5
631643
m_Name: RawImage
632644
m_TagString: Untagged
@@ -647,7 +659,6 @@ RectTransform:
647659
m_ConstrainProportionsScale: 0
648660
m_Children: []
649661
m_Father: {fileID: 411086898}
650-
m_RootOrder: 0
651662
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
652663
m_AnchorMin: {x: 0, y: 0}
653664
m_AnchorMax: {x: 0, y: 0}
@@ -730,3 +741,31 @@ MonoBehaviour:
730741
m_EditorClassIdentifier:
731742
cameraManager: {fileID: 1131137046}
732743
viewMode: 0
744+
focusMode: 0
745+
exposureMode: 0
746+
zoomMode: 0
747+
OnPresent:
748+
m_PersistentCalls:
749+
m_Calls: []
750+
--- !u!114 &1777274305
751+
MonoBehaviour:
752+
m_ObjectHideFlags: 0
753+
m_CorrespondingSourceObject: {fileID: 0}
754+
m_PrefabInstance: {fileID: 0}
755+
m_PrefabAsset: {fileID: 0}
756+
m_GameObject: {fileID: 1777274298}
757+
m_Enabled: 1
758+
m_EditorHideFlags: 0
759+
m_Script: {fileID: 11500000, guid: d0b148fe25e99eb48b9724523833bab1, type: 3}
760+
m_Name:
761+
m_EditorClassIdentifier:
762+
m_Delegates: []
763+
--- !u!1660057539 &9223372036854775807
764+
SceneRoots:
765+
m_ObjectHideFlags: 0
766+
m_Roots:
767+
- {fileID: 963194228}
768+
- {fileID: 705507995}
769+
- {fileID: 411086898}
770+
- {fileID: 1232703158}
771+
- {fileID: 1131137044}

Assets/DetectionVisualizer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/*
22
* BlazePose Detector
3-
* Copyright (c) 2022 NatML Inc. All Rights Reserved.
3+
* Copyright (c) 2023 NatML Inc. All Rights Reserved.
44
*/
55

66
namespace NatML.Examples.Visualizers {
77

88
using System.Collections.Generic;
99
using UnityEngine;
1010
using UnityEngine.UI;
11-
using NatML.VideoKit.UI;
1211
using NatML.Vision;
12+
using VideoKit.UI;
1313

1414
/// <summary>
1515
/// </summary>

BlazePose-Detector.sln

Lines changed: 0 additions & 17 deletions
This file was deleted.

Packages/ai.natml.vision.blazepose.detector/Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.0.3
2+
+ Upgraded to NatML 1.1.16.
3+
14
## 1.0.2
25
+ Refactored `BlazePoseDetector.Pose` struct to `Detection`.
36

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# BlazePose Detector
2-
[MediaPipe BlazePose](https://google.github.io/mediapipe/solutions/pose.html) for person detection in Unity Engine with [NatML](https://github.com/natmlx/NatML).
2+
[MediaPipe BlazePose](https://google.github.io/mediapipe/solutions/pose.html) for person detection in Unity Engine with [NatML](https://github.com/natmlx/natml-unity).
33

44
## Installing BlazePose
55
Add the following items to your Unity project's `Packages/manifest.json`:
@@ -9,48 +9,39 @@ Add the following items to your Unity project's `Packages/manifest.json`:
99
{
1010
"name": "NatML",
1111
"url": "https://registry.npmjs.com",
12-
"scopes": ["ai.natml"]
12+
"scopes": ["ai.fxn", "ai.natml"]
1313
}
1414
],
1515
"dependencies": {
16-
"ai.natml.vision.blazepose.detector": "1.0.2"
16+
"ai.natml.vision.blazepose.detector": "1.0.3"
1717
}
1818
}
1919
```
2020

2121
## Detecting Poses in an Image
2222
First, create the BlazePose detector:
2323
```csharp
24-
// Fetch the model data from NatML
25-
var modelData = await MLModelData.FromHub("@natml/blazepose-detector");
26-
// Deserialize the model
27-
var model = modelData.Deserialize();
2824
// Create the BlazePose detector
29-
var predictor = new BlazePoseDetector(model);
25+
var predictor = await BlazePoseDetector.Create();
3026
```
3127

3228
Then detect pose rectangles in the image:
3329
```csharp
3430
// Create image feature
3531
Texture2D image = ...;
36-
var imageFeature = new MLImageFeature(image);
37-
// Set normalization and aspect mode
38-
(imageFeature.mean, imageFeature.std) = modelData.normalization;
39-
imageFeature.aspectMode = modelData.aspectMode;
4032
// Detect pose regions-of-interest in the image
41-
BlazePoseDetector.Detection[] faces = predictor.Predict(imageFeature);
33+
BlazePoseDetector.Detection[] faces = predictor.Predict(image);
4234
```
4335

4436
___
4537

4638
## Requirements
47-
- Unity 2021.2+
39+
- Unity 2022.3+
4840

4941
## Quick Tips
5042
- Join the [NatML community on Discord](https://hub.natml.ai/community).
5143
- Discover more ML models on [NatML Hub](https://hub.natml.ai).
5244
- See the [NatML documentation](https://docs.natml.ai/unity).
53-
- Discuss [NatML on Unity Forums](https://forum.unity.com/threads/open-beta-natml-machine-learning-runtime.1109339/).
5445
- Contact us at [[email protected]](mailto:[email protected]).
5546

5647
Thank you very much!

0 commit comments

Comments
 (0)