Beispiel #1
0
        public PoseDetect(string modelPath) : base(modelPath, true)
        {
            var options = new SsdAnchorsCalculator.Options()
            {
                inputSizeWidth  = width,
                inputSizeHeight = height,

                minScale = 0.1484375f,
                maxScale = 0.75f,

                anchorOffsetX = 0.5f,
                anchorOffsetY = 0.5f,

                numLayers        = 5,
                featureMapWidth  = new int[0],
                featureMapHeight = new int[0],
                strides          = new int[] { 8, 16, 32, 32, 32 },

                aspectRatios = new float[] { 1.0f },

                reduceBoxesInLowestLayer     = false,
                interpolatedScaleAspectRatio = 1.0f,
                fixedAnchorSize = true,
            };

            anchors = SsdAnchorsCalculator.Generate(options);
            UnityEngine.Debug.AssertFormat(
                anchors.Length == ANCHOR_LENGTH,
                $"Anchors count must be {ANCHOR_LENGTH}, but was {anchors.Length}");

            // Get Keypoint Mode
            var odim0 = interpreter.GetOutputTensorInfo(0).shape;

            KeypointsCount = (odim0[2] - 4) / 2;
        }
Beispiel #2
0
        public void MobileSSDConfig()
        {
            var options = new SsdAnchorsCalculator.Options()
            {
                numLayers = 6,

                minScale = 0.2f,
                maxScale = 0.95f,

                inputSizeHeight = 300,
                inputSizeWidth  = 300,

                anchorOffsetX = 0.5f,
                anchorOffsetY = 0.5f,

                featureMapWidth  = new int[0] {
                },
                featureMapHeight = new int[0] {
                },
                strides          = new int[] { 16, 32, 64, 128, 256, 512 },
                aspectRatios     = new float[] { 1.0f, 2.0f, 0.5f, 3.0f, 0.3333f },

                reduceBoxesInLowestLayer     = true,
                interpolatedScaleAspectRatio = 1.0f,
                fixedAnchorSize = false,
            };

            var testData = LoadTestData("anchor_golden_file_1.txt");
            var anchors  = SsdAnchorsCalculator.Generate(options);

            AreEqual(testData, anchors);
        }
        public PalmDetect(string modelPath) : base(modelPath, true)
        {
            var options = new SsdAnchorsCalculator.Options()
            {
                inputSizeWidth  = 256,
                inputSizeHeight = 256,

                minScale = 0.1171875f,
                maxScale = 0.75f,

                anchorOffsetX = 0.5f,
                anchorOffsetY = 0.5f,

                numLayers        = 5,
                featureMapWidth  = new int[0],
                featureMapHeight = new int[0],
                strides          = new int[] { 8, 16, 32, 32, 32 },

                aspectRatios = new float[] { 1.0f },

                reduceBoxesInLowestLayer     = false,
                interpolatedScaleAspectRatio = 1.0f,
                fixedAnchorSize = true,
            };

            anchors = SsdAnchorsCalculator.Generate(options);
            UnityEngine.Debug.AssertFormat(anchors.Length == 2944, "Anchors count must be 2944");
        }
Beispiel #4
0
        public void FaceDetectionConfigTest()
        {
            var options = new SsdAnchorsCalculator.Options()
            {
                numLayers = 5,

                minScale = 0.1171875f,
                maxScale = 0.75f,

                inputSizeHeight = 256,
                inputSizeWidth  = 256,

                anchorOffsetX = 0.5f,
                anchorOffsetY = 0.5f,

                featureMapWidth  = new int[0] {
                },
                featureMapHeight = new int[0] {
                },
                strides          = new int[] { 8, 16, 32, 32, 32 },
                aspectRatios     = new float[] { 1.0f },

                reduceBoxesInLowestLayer     = false,
                interpolatedScaleAspectRatio = 1.0f,
                fixedAnchorSize = true,
            };

            var testData = LoadTestData("anchor_golden_file_0.txt");
            var anchors  = SsdAnchorsCalculator.Generate(options);

            AreEqual(testData, anchors);
        }