我需要比较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));
最佳答案
您是否为保存新标签的用户调用了标签/保存之后的面部/培训?因为如果不这样做,您将仅使用旧的用户标签执行识别。
另请注意,用户ID不能有空格,请确保检查FCResponse.Status属性是否存在错误。