Upload 4 files
Browse files- README.md +1 -1
- RunIris.cs +5 -11
- info.json +1 -1
- iris_landmark.sentis +2 -2
README.md
CHANGED
@@ -4,7 +4,7 @@ license: apache-2.0
|
|
4 |
library_name: unity-sentis
|
5 |
---
|
6 |
|
7 |
-
# Iris Landmark from Google Mediapipe validated for Unity Sentis (Version 1.
|
8 |
*Version 1.3.0 Sentis files are not compatible with Sentis 1.4.0 and need to be recreated/downloaded
|
9 |
|
10 |
This is the [Iris Landmark model](https://github.com/google/mediapipe/blob/master/docs/solutions/iris.md) from Google in the Sentis format.
|
|
|
4 |
library_name: unity-sentis
|
5 |
---
|
6 |
|
7 |
+
# Iris Landmark from Google Mediapipe validated for Unity Sentis (Version 1.4.0-pre.2*)
|
8 |
*Version 1.3.0 Sentis files are not compatible with Sentis 1.4.0 and need to be recreated/downloaded
|
9 |
|
10 |
This is the [Iris Landmark model](https://github.com/google/mediapipe/blob/master/docs/solutions/iris.md) from Google in the Sentis format.
|
RunIris.cs
CHANGED
@@ -52,9 +52,6 @@ public class RunIris : MonoBehaviour
|
|
52 |
//Holds image size
|
53 |
const int size = 64;
|
54 |
|
55 |
-
Ops ops;
|
56 |
-
ITensorAllocator allocator;
|
57 |
-
|
58 |
Model model;
|
59 |
|
60 |
//webcam device name:
|
@@ -64,7 +61,6 @@ public class RunIris : MonoBehaviour
|
|
64 |
|
65 |
void Start()
|
66 |
{
|
67 |
-
allocator = new TensorCachingAllocator();
|
68 |
|
69 |
//(Note: if using a webcam on mobile get permissions here first)
|
70 |
|
@@ -82,7 +78,6 @@ public class RunIris : MonoBehaviour
|
|
82 |
public void SetupEngine()
|
83 |
{
|
84 |
worker = WorkerFactory.CreateWorker(backend, model);
|
85 |
-
ops = WorkerFactory.CreateOps(backend, allocator);
|
86 |
}
|
87 |
void SetupTextures()
|
88 |
{
|
@@ -190,10 +185,11 @@ public class RunIris : MonoBehaviour
|
|
190 |
var transform = new TextureTransform();
|
191 |
transform.SetDimensions(size, size, 3);
|
192 |
transform.SetTensorLayout(0, 1, 2, 3);
|
193 |
-
using var
|
194 |
|
|
|
195 |
// Pre-process the image to make input in range (-1..1)
|
196 |
-
using var image = ops.Mad(image0, 2f, -1f);
|
197 |
|
198 |
worker.Execute(image);
|
199 |
|
@@ -202,8 +198,8 @@ public class RunIris : MonoBehaviour
|
|
202 |
|
203 |
float scaleX = targetTexture.width * 1f / size;
|
204 |
float scaleY = targetTexture.height * 1f / size;
|
205 |
-
eyeLandmarks.
|
206 |
-
irisLandmarks.
|
207 |
|
208 |
//Draw the markers
|
209 |
RenderTexture.active = targetTexture;
|
@@ -233,8 +229,6 @@ public class RunIris : MonoBehaviour
|
|
233 |
void CleanUp()
|
234 |
{
|
235 |
closing = true;
|
236 |
-
ops?.Dispose();
|
237 |
-
allocator?.Dispose();
|
238 |
if (webcam) Destroy(webcam);
|
239 |
if (video) Destroy(video);
|
240 |
RenderTexture.active = null;
|
|
|
52 |
//Holds image size
|
53 |
const int size = 64;
|
54 |
|
|
|
|
|
|
|
55 |
Model model;
|
56 |
|
57 |
//webcam device name:
|
|
|
61 |
|
62 |
void Start()
|
63 |
{
|
|
|
64 |
|
65 |
//(Note: if using a webcam on mobile get permissions here first)
|
66 |
|
|
|
78 |
public void SetupEngine()
|
79 |
{
|
80 |
worker = WorkerFactory.CreateWorker(backend, model);
|
|
|
81 |
}
|
82 |
void SetupTextures()
|
83 |
{
|
|
|
185 |
var transform = new TextureTransform();
|
186 |
transform.SetDimensions(size, size, 3);
|
187 |
transform.SetTensorLayout(0, 1, 2, 3);
|
188 |
+
using var image = TextureConverter.ToTensor(source, transform);
|
189 |
|
190 |
+
//The image has pixels in the range (0..1)
|
191 |
// Pre-process the image to make input in range (-1..1)
|
192 |
+
//using var image = ops.Mad(image0, 2f, -1f);
|
193 |
|
194 |
worker.Execute(image);
|
195 |
|
|
|
198 |
|
199 |
float scaleX = targetTexture.width * 1f / size;
|
200 |
float scaleY = targetTexture.height * 1f / size;
|
201 |
+
eyeLandmarks.CompleteOperationsAndDownload();
|
202 |
+
irisLandmarks.CompleteOperationsAndDownload();
|
203 |
|
204 |
//Draw the markers
|
205 |
RenderTexture.active = targetTexture;
|
|
|
229 |
void CleanUp()
|
230 |
{
|
231 |
closing = true;
|
|
|
|
|
232 |
if (webcam) Destroy(webcam);
|
233 |
if (video) Destroy(video);
|
234 |
RenderTexture.active = null;
|
info.json
CHANGED
@@ -6,6 +6,6 @@
|
|
6 |
"iris_landmark.sentis"
|
7 |
],
|
8 |
"version" : [
|
9 |
-
"1.
|
10 |
]
|
11 |
}
|
|
|
6 |
"iris_landmark.sentis"
|
7 |
],
|
8 |
"version" : [
|
9 |
+
"1.4.0"
|
10 |
]
|
11 |
}
|
iris_landmark.sentis
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:99643355e175731b9a9fa5f9023e06641deaf8c6b820911f5ac63899431afd57
|
3 |
+
size 5869252
|