求教人脸对比返回结果始终是100,完全匹配的错误
huhuand 发布于2019-10 浏览:1633 回复:1
0
收藏

使用人脸对比,即便是用的非人类图片与之对比,还是返回结果为100,如上图

部分代码如下,不知道为什么总是100,传入的两张base64码是不一样的

public string match(string strbaser64_1,string strbaser64_2,string category)
        {
            string token1 = AccessToken.getAccessToken();
            JObject jsonObj = JObject.Parse(token1);
            string token = jsonObj["access_token"].ToString();
            string host = "https://aip.baidubce.com/rest/2.0/face/v3/match?access_token=" + token;
            Encoding encoding = Encoding.Default;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(host);
            request.Method = "post";
            request.KeepAlive = true;
            String str =
                "[{\"image\":\""+ strbaser64_1+"\",\"image_type\":\"BASE64\",\"face_type\":\""+ category + "\"," +
                "\"quality_control\":\"LOW\"," +
                "\"liveness_control\":\"HIGH\"}," +
                "{\"image\":\""+ strbaser64_2+"\",\"image_type\":\"BASE64\"," +
                "\"face_type\":\"" + category + "\"," +
                "\"quality_control\":\"LOW\"," +
                "\"liveness_control\":\"HIGH\"}]";
            byte[] buffer = encoding.GetBytes(str);
            request.ContentLength = buffer.Length;
            request.GetRequestStream().Write(buffer, 0, buffer.Length);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.Default);
            string result = reader.ReadToEnd();
            Console.WriteLine("人脸对比:");
            Console.WriteLine(result);
            return result;
        }
收藏
点赞
0
个赞
共1条回复 最后由涅槃丨q回复于2019-10
#2涅槃丨q回复于2019-10

你把liveness_control 的参数修改一下试试呢?

0
TOP
切换版块