예제 #1
0
        private SignalClassifierController.PredictionResult predictFrame(
            IEnumerable <IEnumerable <short> > frame, int frameSize, SignalClassifierController classifier, int sensorQty)
        {
            var adjustedFrame =
                Enumerable.Repeat(Enumerable.Repeat <short>(0, sensorQty), frameSize).ToArray();

            var frameArray = frame.ToArray();

            for (int i = 0; i < (frameArray.Length > frameSize ? adjustedFrame.Length : frameArray.Length); i++)
            {
                adjustedFrame[i] = frameArray[i];
            }

            string strFrameSize = "";

            if (frameSize == 100)
            {
                strFrameSize = "single";
            }
            else if (frameSize == 200)
            {
                strFrameSize = "double";
            }
            else
            {
                strFrameSize = "half";
            }

            string sensorType = "";

            if (sensorQty == 4)
            {
                sensorType = "four";
            }
            else
            {
                sensorType = "two";
            }

            return(classifier.predict(strFrameSize, sensorType, classifier.convertFrame(adjustedFrame)));
        }