Handle SkyBiometry API

i need to compare 2 photos similarity. For example picture of son and father and return a percentage of their similarity. I use for SkyBiometry.Client.FC. Something wrong with results returned by API. In all cases of recognizing i get 60%-68% of similarity(threshold).
Finally i tried to compare two same pictures and get result of 54%. I’m confused.What i do wrong? This is my code:

var client = new FCClient("my client id", "my client secret");

            var path = Server.MapPath("~/Content/Upload/1");

            var ids = new List<string> { "my client id" };
            var urls = new List<string>();

            Stream firstPicStream = System.IO.File.OpenRead(Path.Combine(path, "me.jpg"));
            Stream secondPicStream = System.IO.File.OpenRead(Path.Combine(path, "me.jpg"));

            var result1 = client.Faces.EndDetect(client.Faces.BeginDetect(null, new Stream[] { firstPicStream }, Detector.Aggressive, Attributes.Default, null, null));
            var result2 = client.Faces.EndDetect(client.Faces.BeginDetect(null, new Stream[] { secondPicStream }, Detector.Aggressive, Attributes.Default, null, null));


            var tags1 = result1.Photos[0].Tags;
            var tags2 = result2.Photos[0].Tags;
            var tagsIds = tags1.Select(tag => tag.TagId).ToList();
            tagsIds.AddRange(tags2.Select(tag => tag.TagId));

            var tagSaveResponce = client.Tags.EndSave(client.Tags.BeginSave(tagsIds, "My Namespace", "label", null, null));

            var recognizeResult = client.Faces.EndRecognize(client.Faces.BeginRecognize(ids, urls, null, "My Namespace", Detector.Aggressive, Attributes.Default, null, null));

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Did you call faces/train after tags/save for the user you save new tags for? Because if you don’t you will perform recognition with old user tags only.
Also note that user id can not have spaces, make sure you check FCResponse.Status property for possible errors.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply