예제 #1
0
        public RecognitionResult[] Recognize(
            Texture2D texture2D,
            int inputHeight     = 299,
            int inputWidth      = 299,
            float inputMean     = 0.0f,
            float scale         = 1.0f / 255.0f,
            bool flipUpsideDown = true,
            bool swapBR         = false)
        {
            NativeImageIO.ReadTensorFromTexture2D <float>(
                texture2D,
                _inputTensor.DataPointer,
                inputHeight,
                inputWidth,
                inputMean,
                scale,
                flipUpsideDown,
                swapBR);

            _interpreter.Invoke();

            float[] probability = _outputTensor.GetData(false) as float[];
            if (probability == null)
            {
                return(null);
            }

            return(SortResults(probability));
        }
예제 #2
0
        public RecognitionResult[] Recognize(Texture2D texture2D, bool flipUpsideDown = true, bool swapBR = false, float scoreThreshold = 0.0f)
        {
            int height = _inputTensor.Dims[1];
            int width  = _inputTensor.Dims[2];

            NativeImageIO.ReadTensorFromTexture2D <byte>(
                texture2D,
                _inputTensor.DataPointer,
                height, width, 0.0f, 1.0f,
                flipUpsideDown,
                swapBR);

            _interpreter.Invoke();

            return(ConvertResults(scoreThreshold));
        }
예제 #3
0
        public RecognitionResult[] Recognize(Texture2D texture2D, bool flipUpsideDown = true, bool swapBR = false)
        {
            NativeImageIO.ReadTensorFromTexture2D <float>(
                texture2D,
                _inputTensor.DataPointer,
                224, 224, 128.0f, 1.0f / 128.0f,
                flipUpsideDown,
                swapBR);

            _interpreter.Invoke();

            float[] probability = _outputTensor.GetData(false) as float[];
            if (probability == null)
            {
                return(null);
            }

            return(SortResults(probability));
        }