我需要比较 2 张照片的相似度。例如儿子和父亲的照片,并返回他们相似度的百分比。我用于 SkyBiometry.Client.FC。API 返回的结果有问题。在所有识别的情况下,我得到 60%-68% 的相似度(阈值)。最后我尝试比较两张相同的图片并得到 54% 的结果。我很困惑。我做错了什么?这是我的代码:
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));
urls.Add(result1.Photos[0].Url);
urls.Add(result2.Photos[0].Url);
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));