Beispiel #1
0
        public async Task TestMaskRCNNBatch()
        {
            using (Tensor imageTensor = ImageIO.ReadTensorFromImageFiles <byte>(
                       new string[] { "surfers.jpg", "surfers.jpg" },
                       -1,
                       -1,
                       0,
                       1.0f))
                using (MaskRcnnInceptionV2Coco model = new MaskRcnnInceptionV2Coco())
                {
                    await model.Init();

                    MaskRcnnInceptionV2Coco.RecognitionResult[][] results = model.Recognize(imageTensor);
                }
        }
Beispiel #2
0
        public async Task TestResnetBatch()
        {
            using (Tensor imageTensor = ImageIO.ReadTensorFromImageFiles <float>(
                       new string[] { "surfers.jpg", "surfers.jpg" },
                       224,
                       224,
                       0,
                       1.0f / 255.0f))
                using (Resnet resnet = new Resnet())
                {
                    await resnet.Init();

                    Resnet.RecognitionResult[][] results = resnet.Recognize(imageTensor);
                }
        }
Beispiel #3
0
        public async Task TestInceptionBatch()
        {
            //using (Tensor imageTensor = ImageIO.ReadTensorFromImageFile<float>("grace_hopper.jpg", 224, 224, 128.0f, 1.0f))
            using (Tensor imageTensor = ImageIO.ReadTensorFromImageFiles <float>(
                       new String[] { "grace_hopper.jpg", "grace_hopper.jpg" },
                       224,
                       224,
                       128.0f,
                       1.0f))
                using (Inception inceptionGraph = new Inception())
                {
                    await inceptionGraph.Init();

                    Inception.RecognitionResult[][] results = inceptionGraph.Recognize(imageTensor);

                    Trace.WriteLine(String.Format("Object is {0} with {1}% probability", results[0][0].Label, results[0][0].Probability * 100));
                }
        }