PB Unity
commited on
Upload RunBlazeFace.cs
Browse files- RunBlazeFace.cs +7 -10
RunBlazeFace.cs
CHANGED
@@ -175,6 +175,7 @@ public class RunBlazeFace : MonoBehaviour
|
|
175 |
}
|
176 |
|
177 |
//Calculate the centers of the grid squares for two 16x16 grids and six 8x8 grids
|
|
|
178 |
float[] GetGridBoxCoords()
|
179 |
{
|
180 |
var offsets = new float[896 * 4];
|
@@ -204,18 +205,14 @@ public class RunBlazeFace : MonoBehaviour
|
|
204 |
|
205 |
size = model.inputs[0].shape.ToTensorShape()[1]; // Input tensor width
|
206 |
|
207 |
-
model.AddConstant(new Lays.Constant("
|
208 |
-
model.AddConstant(new Lays.Constant("
|
209 |
-
model.AddConstant(new Lays.Constant("
|
210 |
-
|
211 |
-
model.AddLayer(new Lays.Slice("boxes1", "regressors", "zero", "four", "two"));
|
212 |
|
|
|
213 |
model.AddLayer(new Lays.Transpose("scores", "classificators", new int[] { 0, 2, 1 }));
|
214 |
-
|
215 |
-
model.AddConstant(new Lays.Constant("offsets",
|
216 |
-
new TensorFloat(new TensorShape(1, 896, 4), offsets)
|
217 |
-
));
|
218 |
-
model.AddLayer(new Lays.Add("boxCoords", "boxes1", "offsets"));
|
219 |
model.AddOutput("boxCoords");
|
220 |
|
221 |
model.AddConstant(new Lays.Constant("maxOutputBoxes", new int[] { maxOutputBoxes }));
|
|
|
175 |
}
|
176 |
|
177 |
//Calculate the centers of the grid squares for two 16x16 grids and six 8x8 grids
|
178 |
+
//The positions of the faces are given relative to these "anchor points"
|
179 |
float[] GetGridBoxCoords()
|
180 |
{
|
181 |
var offsets = new float[896 * 4];
|
|
|
205 |
|
206 |
size = model.inputs[0].shape.ToTensorShape()[1]; // Input tensor width
|
207 |
|
208 |
+
model.AddConstant(new Lays.Constant("0", new int[] { 0 }));
|
209 |
+
model.AddConstant(new Lays.Constant("2", new int[] { 2 }));
|
210 |
+
model.AddConstant(new Lays.Constant("4", new int[] { 4 }));
|
211 |
+
model.AddConstant(new Lays.Constant("offsets", new TensorFloat(new TensorShape(1, 896, 4), offsets)));
|
|
|
212 |
|
213 |
+
model.AddLayer(new Lays.Slice("boxes", "regressors", "0", "4", "2"));
|
214 |
model.AddLayer(new Lays.Transpose("scores", "classificators", new int[] { 0, 2, 1 }));
|
215 |
+
model.AddLayer(new Lays.Add("boxCoords", "boxes", "offsets"));
|
|
|
|
|
|
|
|
|
216 |
model.AddOutput("boxCoords");
|
217 |
|
218 |
model.AddConstant(new Lays.Constant("maxOutputBoxes", new int[] { maxOutputBoxes }));
|