PB Unity
commited on
Upload RunBlazePalm.cs
Browse files- RunBlazePalm.cs +12 -13
RunBlazePalm.cs
CHANGED
|
@@ -207,24 +207,23 @@ public class RunBlazePalm : MonoBehaviour
|
|
| 207 |
//We need to add extra layers to the model in order to aggregate the box predicions:
|
| 208 |
size = model.inputs[0].shape.ToTensorShape()[2]; // Input tensor width (192)
|
| 209 |
|
| 210 |
-
|
| 211 |
-
model.AddConstant(new Lays.Constant("
|
| 212 |
-
model.AddConstant(new Lays.Constant("
|
| 213 |
-
|
| 214 |
-
model.
|
| 215 |
-
|
| 216 |
-
model.
|
| 217 |
-
|
| 218 |
model.AddConstant(new Lays.Constant("offsets",
|
| 219 |
-
new TensorFloat(new TensorShape(1, offsets.Length/4, 4), offsets)
|
| 220 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
model.AddLayer(new Lays.Add("boxCoords", "boxes", "offsets"));
|
| 222 |
model.AddOutput("boxCoords");
|
| 223 |
|
| 224 |
-
model.AddConstant(new Lays.Constant("maxOutputBoxes", new int[] { maxOutputBoxes }));
|
| 225 |
-
model.AddConstant(new Lays.Constant("iouThreshold", new float[] { iouThreshold }));
|
| 226 |
-
model.AddConstant(new Lays.Constant("scoreThreshold", new float[] { scoreThreshold }));
|
| 227 |
-
|
| 228 |
model.AddLayer(new Lays.NonMaxSuppression("NMS", "boxCoords", "scores",
|
| 229 |
"maxOutputBoxes", "iouThreshold", "scoreThreshold",
|
| 230 |
centerPointBox: Lays.CenterPointBox.Center
|
|
|
|
| 207 |
//We need to add extra layers to the model in order to aggregate the box predicions:
|
| 208 |
size = model.inputs[0].shape.ToTensorShape()[2]; // Input tensor width (192)
|
| 209 |
|
| 210 |
+
//set constants
|
| 211 |
+
model.AddConstant(new Lays.Constant("0", new int[] { 0 }));
|
| 212 |
+
model.AddConstant(new Lays.Constant("2", new int[] { 2 }));
|
| 213 |
+
model.AddConstant(new Lays.Constant("4", new int[] { 4 }));
|
| 214 |
+
model.AddConstant(new Lays.Constant("maxOutputBoxes", new int[] { maxOutputBoxes }));
|
| 215 |
+
model.AddConstant(new Lays.Constant("iouThreshold", new float[] { iouThreshold }));
|
| 216 |
+
model.AddConstant(new Lays.Constant("scoreThreshold", new float[] { scoreThreshold }));
|
|
|
|
| 217 |
model.AddConstant(new Lays.Constant("offsets",
|
| 218 |
+
new TensorFloat(new TensorShape(1, offsets.Length / 4, 4), offsets)
|
| 219 |
));
|
| 220 |
+
|
| 221 |
+
//add layers
|
| 222 |
+
model.AddLayer(new Lays.Slice("boxes", regressorsOutput, "0", "4", "2"));
|
| 223 |
+
model.AddLayer(new Lays.Transpose("scores", classificatorsOutput, new int[] { 0, 2, 1 }));
|
| 224 |
model.AddLayer(new Lays.Add("boxCoords", "boxes", "offsets"));
|
| 225 |
model.AddOutput("boxCoords");
|
| 226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
model.AddLayer(new Lays.NonMaxSuppression("NMS", "boxCoords", "scores",
|
| 228 |
"maxOutputBoxes", "iouThreshold", "scoreThreshold",
|
| 229 |
centerPointBox: Lays.CenterPointBox.Center
|