Exemplo n.º 1
0
        public IdentificationViewModel(IInternalDataService dataService, ICustomVisionPredictionClient predictionService)
        {
            _dataService       = dataService;
            _predictionService = predictionService;


            TakePhoto = new Command(async(obj) => await TakePhotoProcess(obj));
            PickPhoto = new Command(async(obj) => await PickPhotoProcess(obj));
        }
Exemplo n.º 2
0
        public Predicao()
        {
            _servicoCognitivoDeVisaoPersonalizadaPredicao = new CustomVisionPredictionClient()
            {
                ApiKey   = _chaveDePredicao,
                Endpoint = _endpoint
            };

            _treinamento = new Treinamento();
        }
        public void DetectImageNoStore()
        {
            using (MockContext context = MockContext.Start(this.GetType()))
            {
                HttpMockServer.Initialize(this.GetType(), "DetectImageNoStore", RecorderMode);

                ICustomVisionPredictionClient client = GetPredictionClientClient();
                using (FileStream stream = new FileStream(Path.Combine("TestImages", "test_image.jpg"), FileMode.Open))
                {
                    ImagePrediction results = client.DetectImageWithNoStore(ObjectDetectionProjectId, ObjDetectionPublishedName, stream);
                    ValidateObjDetectionResults(results);
                }
            }
        }
Exemplo n.º 4
0
        public void PredictImage()
        {
            using (MockContext context = MockContext.Start(this.GetType().Name))
            {
                HttpMockServer.Initialize(this.GetType().Name, "PredictImage", RecorderMode);

                ICustomVisionPredictionClient client = GetPredictionClientClient();
                using (FileStream stream = new FileStream(Path.Combine("TestImages", "test_image.jpg"), FileMode.Open))
                {
                    ImagePrediction results = client.PredictImageAsync(ProjectId, stream).Result;
                    ValidateResults(results);
                }
            }
        }
        public void ClassifyImageUrlNoStore()
        {
            string testImageUrl = "https://raw.githubusercontent.com/Microsoft/Cognitive-CustomVision-Windows/master/Samples/Images/Test/test_image.jpg";

            using (MockContext context = MockContext.Start(this.GetType()))
            {
                HttpMockServer.Initialize(this.GetType(), "ClassifyImageUrlNoStore", RecorderMode);

                ICustomVisionPredictionClient client = GetPredictionClientClient();
                ImageUrl url = new ImageUrl(testImageUrl);

                ImagePrediction results = client.ClassifyImageUrlWithNoStore(ClassificationProjectId, ClassificationPublishedName, url);
                ValidateResults(results);
            }
        }
Exemplo n.º 6
0
        public void PredictImageUrl()
        {
            string testImageUrl = "https://raw.githubusercontent.com/Microsoft/Cognitive-CustomVision-Windows/master/Samples/Images/Test/test_image.jpg";

            using (MockContext context = MockContext.Start(this.GetType().Name))
            {
                HttpMockServer.Initialize(this.GetType().Name, "PredictImageUrl", RecorderMode);

                ICustomVisionPredictionClient client = GetPredictionClientClient();
                ImageUrl url = new ImageUrl(testImageUrl);

                ImagePrediction results = client.PredictImageUrlAsync(ProjectId, url).Result;
                ValidateResults(results);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Predict an image url and saves the result
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='projectId'>
 /// The project id
 /// </param>
 /// <param name='imageUrl'>
 /// An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be
 /// evaluated
 /// </param>
 /// <param name='iterationId'>
 /// Optional. Specifies the id of a particular iteration to evaluate against.
 /// The default iteration for the project will be used when not specified
 /// </param>
 /// <param name='application'>
 /// Optional. Specifies the name of application using the endpoint
 /// </param>
 public static ImagePrediction PredictImageUrl(this ICustomVisionPredictionClient operations, System.Guid projectId, ImageUrl imageUrl, System.Guid?iterationId = default(System.Guid?), string application = default(string))
 {
     return(operations.PredictImageUrlAsync(projectId, imageUrl, iterationId, application).GetAwaiter().GetResult());
 }
Exemplo n.º 8
0
 /// <summary>
 /// Predict an image without saving the result
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='projectId'>
 /// The project id
 /// </param>
 /// <param name='imageData'>
 /// </param>
 /// <param name='iterationId'>
 /// Optional. Specifies the id of a particular iteration to evaluate against.
 /// The default iteration for the project will be used when not specified
 /// </param>
 /// <param name='application'>
 /// Optional. Specifies the name of application using the endpoint
 /// </param>
 /// <param name='customHeaders'>
 /// Headers that will be added to request.
 /// </param>
 public static HttpOperationResponse <ImagePrediction> PredictImageWithNoStoreWithHttpMessages(this ICustomVisionPredictionClient operations, System.Guid projectId, Stream imageData, System.Guid?iterationId = default(System.Guid?), string application = default(string), Dictionary <string, List <string> > customHeaders = null)
 {
     return(operations.PredictImageWithNoStoreWithHttpMessagesAsync(projectId, imageData, iterationId, application, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult());
 }
Exemplo n.º 9
0
 /// <summary>
 /// Predict an image without saving the result
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='projectId'>
 /// The project id
 /// </param>
 /// <param name='imageData'>
 /// </param>
 /// <param name='iterationId'>
 /// Optional. Specifies the id of a particular iteration to evaluate against.
 /// The default iteration for the project will be used when not specified
 /// </param>
 /// <param name='application'>
 /// Optional. Specifies the name of application using the endpoint
 /// </param>
 public static ImagePrediction PredictImageWithNoStore(this ICustomVisionPredictionClient operations, System.Guid projectId, Stream imageData, System.Guid?iterationId = default(System.Guid?), string application = default(string))
 {
     return(operations.PredictImageWithNoStoreAsync(projectId, imageData, iterationId, application).GetAwaiter().GetResult());
 }
Exemplo n.º 10
0
 public Challenge2(ICustomVisionPredictionClient customVisionPredictionClient)
 {
     _customVisionPredictionClient = customVisionPredictionClient;
 }
Exemplo n.º 11
0
 public CustomVisionProcessorService(ICustomVisionPredictionClient predictionClient, ProjectIteration[] projectIterations)
 {
     //set fields
     _predictionClient = predictionClient;
     ProjectIterations = projectIterations;
 }