예제 #1
0
        public string Get([FromQuery] PDMData instancia)
        {
            var predicao = predEngine.Predict(instancia);

            return(predicao.TituloPDMPredict);
        }
예제 #2
0
        public bool doStep()
        {
            if (_stepCounter >= maxStep)
            {
                return(false);
            }
            _stepCounter++;
            if (isConverge())
            {
                return(false);
            }

            int i, j;
            // Calculate Movement
            int detectedEdgeCnt = calculateMovement(_XdX);

            // Compute Change
            CXYVector  currentShape = new CXYVector(_PDMData.mean);
            CMatrix3x3 pose         = CXYVector.realign(currentShape, _XdX, _weight);

            // Get Residual Adjustment
            CXYVector XdX = new CXYVector(_XdX);

            XdX.transform(pose.inverse());
            double [] dx = XdX.substractDouble(_PDMData.mean);

            // Translate Into Model Parameter
            double  [] db = new double[_PDMData.freedom];
            double [,] vectorsPtr = _PDMData.eigen.vectors;
            double dimension = _size * 2;

            for (i = 0; i < _PDMData.freedom; i++)
            {
                db[i] = 0;
                for (j = 0; j < dimension; j++)
                {
                    db[i] += vectorsPtr[j, i] * dx[j];
                }
            }

            // Find Out If Parameter Is Out Of Limit
            double dm = 0.0;

            for (i = 0; i < _PDMData.freedom; i++)
            {
                dm += (db[i] * db[i]) / _PDMData.eigen.values[i];
            }

            // If It Does, Apply Limit
            dm = Math.Sqrt(dm);
            if (dm > 3.0)
            {
                for (i = 0; i < _PDMData.freedom; i++)
                {
                    db[i] *= 3.0 / dm;
                }
            }

            // Update Parameter
            currentShape = PDMData.generateNewVariation(-1, db);
            CXYVector.realign(currentShape, _XdX, _weight);
            //currentShape.transform(pose);
            _energy    = _ASMResult.distance(currentShape);
            _ASMResult = currentShape;

            return(detectedEdgeCnt > (_ASMResult.size / 10));
        }