阿里云新版人脸识别 C# 使用示例教程-阿里云开发者社区

开发者社区> 开发与运维> 正文

阿里云新版人脸识别 C# 使用示例教程

简介: 前面分别介绍了新版人脸识别服务接口的开通、JAVA SDK对通用人脸识别通用方法的调用及1:N人脸识别接口的调用,可以参考阿里云人脸识别公测使用说明与阿里云人脸识别 1:N 使用简明示例,本文主要介绍如何使用C# 程序调用阿里云新版人脸识别接口。

概述

前面分别介绍了新版人脸识别服务接口的开通、JAVA SDK对通用人脸识别通用方法的调用及1:N人脸识别接口的调用,可以参考阿里云人脸识别公测使用说明阿里云人脸识别 1:N 使用简明示例,本文主要介绍如何使用C# 程序调用阿里云新版人脸识别接口。

操作步骤

1、SDK下载:aliyun-net-sdk-core
_

2、Code Sample

using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Http;
using Aliyun.Acs.Core.Profile;
using System;

namespace FaceDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            // 参数设置
            string groupName = "default1";
            string person = "LiuYifei";
            string image_1 = "photo1";
            string image_2 = "photo2";
            string imageUrl_1 = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1559655604341&di=3d6995f6dee1c4795d1827e754a00452&imgtype=0&src=http%3A%2F%2Fimg0.ph.126.net%2F90u9atgu46nnziAm1NMAGw%3D%3D%2F6631853916514183512.jpg";
            string imageUrl_2 = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1559655604338&di=ee3d8fb39f6e14a21852a4ac3f2c5a14&imgtype=0&src=http%3A%2F%2Fc4.haibao.cn%2Fimg%2F600_0_100_0%2F1473652712.0005%2F87c7805c10e60e9a6db94f86d6014de8.jpg";
            String recognizeFaceImageUrl = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1559655604335&di=7b540d703955aed6d235752589aee34a&imgtype=0&src=http%3A%2F%2Fphotocdn.sohu.com%2F20140317%2FImg396736687.jpg";

            // DefaultProfile.getProfile的参数分别是地域,access_key_id, access_key_secret
            IClientProfile profile = DefaultProfile.GetProfile("cn-shanghai", "******", "******");
            DefaultAcsClient client = new DefaultAcsClient(profile);

            Console.WriteLine("基本功能测试:");
            // 人脸检测定位
            DetectFace(client, imageUrl_1);

            Console.WriteLine("---------------------------------------");
            // 人脸属性识别
            GetFaceAttribute(client, imageUrl_1);
            // 人脸对比
            Console.WriteLine("---------------------------------------");
            VerifyFace(client, imageUrl_1, imageUrl_2);

            Console.WriteLine("1:N 功能测试:");

            //添加入两张人脸
            AddFace(client, groupName, person, image_1, imageUrl_1);
            AddFace(client, groupName, person, image_2, imageUrl_2);

            //列举Group
            ListGroup(client);

            //列举Faces
            ListFace(client, groupName);

            //人脸查询
            RecognizeFace(client, recognizeFaceImageUrl);

            //删除Face
            DeleteFace(client, groupName, person, image_1);

            //列举Faces查询删除情况
            ListFace(client, groupName);

            Console.ReadLine();

        }

        /// <summary>
        /// DetectFace API 人脸检测定位
        /// </summary>
        /// <param name="client">client对象</param>
        /// <param name="imageUrl_1">检测人脸图片的URL</param>
        public static void DetectFace(DefaultAcsClient client, String imageUrl_1)
        {
            CommonRequest request = new CommonRequest();
            request.Method = MethodType.POST;
            request.Domain = "face.cn-shanghai.aliyuncs.com";
            request.Action = "DetectFace";
            request.Version = "2018-12-03";
            request.AddBodyParameters("ImageUrl", imageUrl_1);
            CommonResponse response = null;

            // Initiate the request and get the response
            response = client.GetCommonResponse(request);
            Console.WriteLine(response.Data);
        }

        /// <summary>
        /// DetectFace API 人脸检测定位
        /// </summary>
        /// <param name="client">client对象</param>
        /// <param name="imageUrl_1">检测人脸图片的URL</param>
        public static void GetFaceAttribute(DefaultAcsClient client, String imageUrl_1)
        {
            CommonRequest request = new CommonRequest();
            request.Method = MethodType.POST;
            request.Domain = "face.cn-shanghai.aliyuncs.com";
            request.Action = "GetFaceAttribute";
            request.Version = "2018-12-03";
            request.AddBodyParameters("ImageUrl", imageUrl_1);
            CommonResponse response = null;

            // Initiate the request and get the response
            response = client.GetCommonResponse(request);
            Console.WriteLine(response.Data);
        }

        /// <summary>
        /// VerifyFace API 人脸比对
        /// </summary>
        /// <param name="client">client对象</param>
        /// <param name="imageUrl_1">对比人脸图片1</param>
        /// <param name="imageUrl_2">对比人脸图片2</param>
        public static void VerifyFace(DefaultAcsClient client, String imageUrl_1, string imageUrl_2)
        {
            CommonRequest request = new CommonRequest();
            request.Method = MethodType.POST;
            request.Domain = "face.cn-shanghai.aliyuncs.com";
            request.Action = "VerifyFace";
            request.Version = "2018-12-03";
            request.AddBodyParameters("ImageUrl1", imageUrl_1);
            request.AddBodyParameters("ImageUrl2", imageUrl_2);

            CommonResponse response = null;

            // Initiate the request and get the response
            response = client.GetCommonResponse(request);
            Console.WriteLine(response.Data);
        }

        /// <summary>
        /// AddFace接口用于向人脸库中添加人脸
        /// </summary>
        /// <param name="client">client对象</param>
        /// <param name="groupName">添加人脸的分组</param>
        /// <param name="person">添加人脸的姓名</param>
        /// <param name="image">添加人脸的编号</param>
        /// <param name="imageUrl">检测图片的URL</param>
        public static void AddFace(DefaultAcsClient client, string groupName, string person, string image, string imageUrl)
        {
            CommonRequest request = new CommonRequest();
            request.Method = MethodType.POST;
            request.Domain = "face.cn-shanghai.aliyuncs.com";
            request.Version = "2018-12-03";
            request.Action = "AddFace";
            request.AddBodyParameters("Group", groupName);
            request.AddBodyParameters("Person", person);
            request.AddBodyParameters("Image", image);
            request.AddBodyParameters("ImageUrl", imageUrl);
            CommonResponse response = null;

            // Initiate the request and get the response
            response = client.GetCommonResponse(request);
            Console.WriteLine(response.Data);
        }

        /// <summary>
        /// DeleteFace接口用于从人脸库中删除人脸
        /// </summary>
        /// <param name="client">client对象</param>
        /// <param name="groupName">删除人脸的分组</param>
        /// <param name="person">删除人脸的姓名</param>
        /// <param name="image">删除人脸的编号</param>
        public static void DeleteFace(DefaultAcsClient client, string groupName, string person, string image)
        {
            CommonRequest request = new CommonRequest();
            request.Method = MethodType.POST;
            request.Domain = "face.cn-shanghai.aliyuncs.com";
            request.Version = "2018-12-03";
            request.Action = "DeleteFace";
            request.AddBodyParameters("Group", groupName);
            request.AddBodyParameters("Person", person);
            request.AddBodyParameters("Image", image);
            CommonResponse response = null;

            // Initiate the request and get the response
            response = client.GetCommonResponse(request);
            Console.WriteLine(response.Data);
        }

        /// <summary>
        /// ListFace接口用于列举注册库中的人脸
        /// </summary>
        /// <param name="client">client对象</param>
        /// <param name="groupName">需要查询的库</param>
        public static void ListFace(DefaultAcsClient client, string groupName)
        {
            CommonRequest request = new CommonRequest();
            request.Method = MethodType.POST;
            request.Domain = "face.cn-shanghai.aliyuncs.com";
            request.Version = "2018-12-03";
            request.Action = "ListFace";
            request.AddBodyParameters("Group", groupName);
            CommonResponse response = null;

            // Initiate the request and get the response
            response = client.GetCommonResponse(request);
            Console.WriteLine(response.Data);
        }

        /// <summary>
        /// ListGroup接口用于列举人脸组
        /// </summary>
        /// <param name="client">client对象</param>
        public static void ListGroup(DefaultAcsClient client)
        {
            CommonRequest request = new CommonRequest();
            request.Method = MethodType.POST;
            request.Domain = "face.cn-shanghai.aliyuncs.com";
            request.Version = "2018-12-03";
            request.Action = "ListGroup";
            CommonResponse response = null;

            // Initiate the request and get the response
            response = client.GetCommonResponse(request);
            Console.WriteLine(response.Data);
        }

        /// <summary>
        /// RecognizeFace接口用于查找注册库中的人脸
        /// </summary>
        /// <param name="client">client对象</param>
        /// <param name="recognizeFaceImageUrl">需要查询的人类图片URL</param>
        public static void RecognizeFace(DefaultAcsClient client, string recognizeFaceImageUrl)
        {
            CommonRequest request = new CommonRequest();
            request.Method = MethodType.POST;
            request.Domain = "face.cn-shanghai.aliyuncs.com";
            request.Version = "2018-12-03";
            request.Action = "RecognizeFace";
            request.AddBodyParameters("Group", "default");
            request.AddBodyParameters("ImageUrl", recognizeFaceImageUrl);
            CommonResponse response = null;

            // Initiate the request and get the response
            response = client.GetCommonResponse(request);
            Console.WriteLine(response.Data);
        }
    }
}

3、示例程序运行结果

基本功能测试:
{"Data":{"landmark":[799.2508544921875,1096.208740234375,1240.654296875,1094.9720458984375,1017.4330444335938,998.57861328125,1019.7756958007812,1073.234375,856.2061767578125,1035.13671875,933.8515625,1003.8469848632812,1100.0830078125,1011.6668701171875,1179.436767578125,1038.3056640625,872.8338623046875,1087.581298828125,945.71942138671875,1074.416015625,1093.3974609375,1081.538818359375,1166.590576171875,1092.97607421875,1493.1463623046875,1106.8787841796875,1803.4925537109375,1122.54248046875,1661.3282470703125,1008.6871948242188,1651.0706787109375,1079.126953125,1537.4063720703125,1056.8326416015625,1597.4547119140625,1028.1773681640625,1726.907470703125,1018.4874267578125,1778.471435546875,1060.5947265625,1546.176025390625,1099.3516845703125,1597.8970947265625,1085.4248046875,1704.5565185546875,1081.686279296875,1754.29541015625,1101.360595703125,950.329833984375,1237.64794921875,1183.385009765625,1267.03759765625,977.181396484375,1217.33203125,1007.8623046875,1203.468505859375,1040.79296875,1196.4024658203125,1074.479736328125,1197.28076171875,1107.569091796875,1203.653076171875,1138.1513671875,1217.7967529296875,1163.763427734375,1239.65087890625,972.8101806640625,1259.625244140625,999.7427978515625,1275.834716796875,1029.82177734375,1285.0888671875,1060.949951171875,1289.74853515625,1092.414306640625,1290.66357421875,1123.592041015625,1286.35107421875,1154.080322265625,1278.5302734375,1505.3389892578125,1268.0709228515625,1708.0179443359375,1249.576416015625,1518.981201171875,1239.8076171875,1538.6033935546875,1215.315185546875,1567.039306640625,1202.20703125,1598.1136474609375,1198.019775390625,1629.2843017578125,1201.669677734375,1659.324462890625,1210.7451171875,1686.067138671875,1227.1563720703125,1530.2646484375,1279.018310546875,1556.6688232421875,1285.6533203125,1583.6409912109375,1289.33984375,1610.8587646484375,1289.97509765625,1638.017578125,1288.05908203125,1664.3843994140625,1281.280517578125,1688.3682861328125,1268.41259765625,1356.669921875,1282.080322265625,1408.8363037109375,1560.64453125,1382.7197265625,1421.0,1381.5010986328125,1632.008056640625,1219.308349609375,1626.333251953125,1504.8509521484375,1610.831787109375,1130.4825439453125,1834.1395263671875,1509.7669677734375,1838.226318359375,1168.39501953125,1840.3800048828125,1477.0972900390625,1842.334228515625,1356.515380859375,1776.99951171875,1318.5791015625,1763.8675537109375,1391.8681640625,1763.096435546875,1223.385498046875,1796.4013671875,1458.71044921875,1788.520751953125,1175.30078125,1811.2015380859375,1270.33349609375,1778.24560546875,1426.817626953125,1771.79443359375,1487.899169921875,1809.6094970703125,1339.509521484375,1975.9508056640625,1215.365234375,1935.4556884765625,1444.841064453125,1933.088623046875,1168.38525390625,1888.6160888671875,1273.85400390625,1966.6778564453125,1396.037353515625,1963.970703125,1483.1046142578125,1889.708984375,1350.7132568359375,1842.592041015625,1342.6649169921875,1877.176025390625,1259.4251708984375,1840.41455078125,1253.5074462890625,1868.7591552734375,1413.9844970703125,1838.3511962890625,1413.215087890625,1872.574462890625,1213.9150390625,1836.5245361328125,1210.5072021484375,1855.8992919921875,1305.033935546875,1843.0133056640625,1297.79638671875,1876.015380859375,1382.399658203125,1841.2255859375,1378.171142578125,1878.257080078125,1445.6971435546875,1837.94091796875,1446.6396484375,1860.6153564453125,622.818603515625,1224.1640625,1785.5914306640625,1214.9752197265625,1357.4207763671875,2194.99365234375,768.70306396484375,1845.98193359375,1715.2325439453125,1736.135498046875,668.5491943359375,1537.0185546875,1775.165771484375,1473.250732421875,1036.9564208984375,2098.42333984375,1579.2042236328125,2001.826416015625],"pose":[10.426637649536133,-4.4992427825927734,-0.58456879854202271],"face_prob":[1.0],"request_id":"F5B75D1D-116B-497C-9F15-A5C215131310","errno":0,"face_num":1,"iris":[1071.598876953125,1235.034912109375,51.706081390380859,1573.8760986328125,1241.315673828125,51.706081390380859],"landmark_num":105,"face_rect":[679,539,1172,1664]},"RequestId":"F5B75D1D-116B-497C-9F15-A5C215131310","Success":true}
---------------------------------------
{"Data":{"expression":[0],"dense_fea":[0.014489538967609406,0.016538651660084724,-0.023658772930502892,0.013664696365594864,-0.0000065937683757510968,0.026864161714911461,0.009717186912894249,-0.021407602354884148,-0.017790507525205612,0.081036828458309174,-0.041878066956996918,-0.049259979277849197,0.027166975662112236,-0.03457220271229744,0.024956922978162766,-0.003477256977930665,0.00749629782512784,0.012343673035502434,0.027639983221888542,-0.0013470854610204697,-0.02497219480574131,-0.039992000907659531,0.013248084113001823,-0.055242054164409637,0.026817528530955315,0.014577757567167282,0.030680198222398758,0.035563424229621887,0.039865355938673019,-0.016590304672718048,-0.018459534272551537,0.015342786908149719,0.024295927956700325,0.038800526410341263,-0.0093837473541498184,-0.020797539502382278,-0.029860416427254677,-0.035162527114152908,0.036738593131303787,0.016661904752254486,-0.055605728179216385,0.017030755057930946,-0.027872627601027489,-0.0088091148063540459,0.0035100330132991076,0.045913524925708771,-0.014117204584181309,-0.0077896709553897381,0.021840522065758705,0.0021388784516602755,-0.028840703889727592,0.009511161595582962,-0.015830272808670998,0.01404818519949913,-0.0049751163460314274,0.030284518375992775,-0.003263640683144331,0.015789885073900223,-0.0028442656621336937,0.0060045588761568069,-0.0092030316591262817,0.0090893534943461418,-0.065636374056339264,0.0062633003108203411,0.037644378840923309,0.0062142754904925823,-0.022539138793945312,-0.016099071130156517,-0.00016700773267075419,-0.021992053836584091,0.023346949368715286,0.010460333898663521,0.031118912622332573,0.0092957764863967896,0.026004362851381302,-0.039720948785543442,0.011129491031169891,-0.0037528832908719778,-0.03406800702214241,-0.0032845332752913237,0.028086043894290924,-0.049992781132459641,-0.044379916042089462,-0.053873840719461441,-0.0059472271241247654,-0.018611164763569832,-0.018737824633717537,-0.026223801076412201,-0.03844602033495903,0.043754462152719498,0.0071030785329639912,-0.00041507702553644776,0.000033848424209281802,-0.03687889501452446,-0.027492456138134003,0.0052762022241950035,-0.04076915979385376,0.006373201496899128,-0.00080548302503302693,-0.0047341980971395969,0.013588062487542629,-0.021721992641687393,-0.02645639143884182,-0.0012647840194404125,0.033307820558547974,-0.019982827827334404,-0.030050616711378098,-0.034289207309484482,-0.034702558070421219,-0.0014659094158560038,-0.022159552201628685,0.070481255650520325,0.053019370883703232,-0.0028498047031462193,-0.040497902780771255,-0.047969724982976913,0.017881143838167191,0.017315134406089783,-0.021546471863985062,-0.0087008215487003326,0.039427589625120163,-0.037930388003587723,0.036068413406610489,-0.012932467274367809,-0.020046278834342957,-0.038609981536865234,-0.024630576372146606,-0.037168033421039581,-0.064253516495227814,-0.01061219722032547,0.011556174606084824,0.069091729819774628,0.0026025322731584311,0.021544905379414558,-0.032362494617700577,0.010130282491445541,-0.0017896442441269755,-0.017583593726158142,0.024318205192685127,0.040466446429491043,-0.055688448250293732,0.030614504590630531,0.015004727058112621,0.0022777991835027933,0.042026001960039139,-0.023331748321652412,-0.025629362091422081,-0.070397280156612396,0.035328991711139679,0.019720055162906647,-0.026434663683176041,-0.033267248421907425,0.0083784135058522224,-0.0054666511714458466,0.044727839529514313,-0.0022101092617958784,0.010776091367006302,0.0097066396847367287,0.0010070346761494875,0.00048953504301607609,0.016940111294388771,0.0015253081219270825,0.0079563809558749199,0.026490213349461555,-0.033233709633350372,0.071802318096160889,-0.037657823413610458,-0.01524182315915823,-0.013042718172073364,-0.036260060966014862,-0.056009352207183838,0.013433981686830521,0.03605954721570015,0.010838278569281101,0.036304447799921036,-0.0020321551710367203,-0.020098697394132614,-0.029213260859251022,0.019547533243894577,-0.0099319126456975937,-0.012605287134647369,-0.080268114805221558,0.024610297754406929,-0.017284680157899857,-0.048286054283380508,0.018836269155144691,0.00093978206859901547,0.029795937240123749,-0.024592673406004906,0.023201268166303635,-0.041373658925294876,-0.045465588569641113,-0.0092790909111499786,-0.006687783170491457,0.033633112907409668,0.030113251879811287,0.0092593049630522728,0.021115435287356377,0.021269297227263451,-0.023881867527961731,0.020923035219311714,0.020335419103503227,0.019599815830588341,0.023156369104981422,0.04763268306851387,0.0080931391566991806,-0.052705489099025726,0.026144735515117645,0.029126562178134918,-0.049951799213886261,0.013731651939451694,0.030543291941285133,-0.057640034705400467,0.010263132862746716,-0.0052347402088344097,0.03250943124294281,0.030083520337939262,-0.027215812355279922,0.03681638091802597,0.0080102533102035522,-0.023411020636558533,-0.019861752167344093,0.02348366379737854,0.025421038269996643,-0.031209599226713181,0.041931852698326111,-0.016714125871658325,0.040425006300210953,0.018220659345388412,-0.019524630159139633,-0.068772725760936737,-0.043695852160453796,0.0096835820004343987,0.051118265837430954,0.025065148249268532,-0.015788543969392776,0.02166157029569149,-0.046189099550247192,0.012737851589918137,-0.031860888004302979,0.025285186246037483,-0.069685511291027069,0.0094765219837427139,0.027464317157864571,-0.003937198780477047,-0.037318803369998932,-0.054401803761720657,-0.019126491621136665,-0.0089641734957695007,0.047553554177284241,-0.013236384838819504,0.021874714642763138,-0.022035576403141022,0.0037614649627357721,0.024435196071863174,0.031740006059408188,-0.064002484083175659,0.023369139060378075,-0.071457557380199432,0.014052934013307095,0.007466090377420187,0.013299132697284222,0.015964861959218979,-0.021811686456203461,0.044636663049459457,-0.0081373415887355804,-0.037216357886791229,-0.018765835091471672,-0.0025224827695637941,-0.028159910812973976,-0.036570370197296143,-0.014575954526662827,0.026359526440501213,0.060567714273929596,0.020822132006287575,0.019370928406715393,-0.068121626973152161,-0.0069934739731252193,-0.070020154118537903,0.0063595129176974297,-0.0054504591971635818,0.033402040600776672,-0.0446818508207798,0.036862749606370926,-0.052953239530324936,0.019433192908763885,-0.040396552532911301,-0.034634880721569061,-0.068576313555240631,0.019127029925584793,-0.055765975266695023,-0.043429538607597351,-0.046108398586511612,-0.043114442378282547,-0.042282488197088242,0.0514637790620327,0.04416893795132637,0.050087995827198029,0.010314316488802433,-0.0047298832796514034,-0.0156147675588727,-0.053818054497241974,0.022244725376367569,0.0035087794531136751,-0.049918737262487411,0.006125573068857193,0.0071573932655155659,-0.031390443444252014,0.00089516869047656655,-0.032042462378740311,-0.0029704852495342493,0.0085553014650940895,0.044979855418205261,0.061059202998876572,-0.011253218166530132,-0.017052238807082176,-0.052730824798345566,0.015101736411452293,0.038259677588939667,0.057694096118211746,-0.040209736675024033,0.01634933240711689,-0.045435134321451187,-0.022646153345704079,0.014607374556362629,0.021585674956440926,-0.030298590660095215,-0.01713675819337368,0.05295339971780777,-0.022746505215764046,-0.024370316416025162,0.025732340291142464,-0.018808508291840553,0.023061694577336311,0.0021706097759306431,-0.05269131064414978,-0.055157918483018875,-0.0098867127671837807,-0.014650445431470871,-0.018753897398710251,0.029422791674733162,0.042700868099927902,0.007001243531703949,-0.022304428741335869,0.051763452589511871,0.019014954566955566,-0.035822015255689621,0.04089992493391037,0.010474968701601028,-0.018766339868307114,-0.0052904216572642326,0.030190257355570793,0.019948888570070267,-0.00064618972828611732,0.024803414940834045,-0.0052940454334020615,-0.014527969993650913,-0.01973743736743927,0.02468097023665905,-0.0071020773611962795,-0.016918415203690529,-0.011482773348689079,0.012833084911108017,-0.046120952814817429,-0.038056403398513794,-0.051108848303556442,0.047111354768276215,-0.0058841411955654621,-0.0089215096086263657,0.035679042339324951,-0.048938725143671036,0.0270052719861269,-0.014121796004474163,0.035106908529996872,-0.00061400479171425104,-0.039146523922681808,-0.0095084914937615395,-0.022867932915687561,0.022390732541680336,0.0082249874249100685,-0.020826756954193115,-0.032257914543151855,0.0044297692365944386,0.01166529580950737,0.024328958243131638,-0.03570198267698288,0.048154581338167191,0.055001158267259598,-0.042237300425767899,0.035300929099321365,-0.066035404801368713,-0.011917853727936745,-0.000079258978075813502,-0.023814832791686058,0.0037736557424068451,0.0016388294752687216,-0.03297705203294754,0.044769231230020523,-0.018120402470231056,-0.038243427872657776,-0.0086623420938849449,0.0084484126418828964,0.072943180799484253,0.0051663010381162167,0.0185252595692873,-0.013009455054998398,0.042986631393432617,0.026181995868682861,0.040690619498491287,-0.01626143604516983,-0.048882137984037399,0.026062715798616409,0.023839030414819717,0.0037464478518813848,0.01400421280413866,-0.033597581088542938,-0.093055479228496552,-0.048876553773880005,0.0028477215673774481,0.014933733269572258,0.071540713310241699,-0.031045135110616684,0.0095123592764139175,-0.013689400628209114,0.013621407561004162,-0.015604824759066105,0.021078690886497498,-0.00062912324210628867,0.02012270875275135,-0.015304765664041042,-0.025525594130158424,-0.054863270372152328,-0.0076800915412604809,-0.03983745351433754,0.01916213147342205,-0.027035441249608994,0.043547656387090683,-0.020871546119451523,0.031350929290056229,-0.0073250471614301205,-0.031921964138746262,0.032987818121910095,-0.02541261725127697,-0.037795171141624451,0.025887779891490936,-0.022894237190485001,-0.012046190910041332,-0.02778785303235054,0.0710272416472435,-0.019103731960058212,-0.023815605789422989,-0.076092563569545746,-0.0041927667334675789,0.0013355220435187221,0.013405295088887215,-0.015520119108259678,0.034896660596132278,-0.0088786482810974121,0.0035306278150528669,-0.012074637226760387,0.028830647468566895,-0.03278244286775589,0.068151965737342834,0.032180417329072952,-0.0093910461291670799,0.027669880539178848,0.0011117082322016358,0.043873060494661331,0.023158358410000801,0.031628262251615524,-0.047853175550699234,0.018131634220480919,0.042597968131303787,0.012855358421802521,-0.024656891822814941,-0.022809835150837898,-0.02791883610188961,0.014018932357430458,-0.014442301355302334,-0.03747875988483429,-0.0037183612585067749,0.003441282082349062,0.014880241826176643,-0.029635345563292503,0.0061772693879902363,-0.024915700778365135,0.02009967714548111,-0.05617859959602356,0.025704612955451012,0.0092512592673301697,0.0023119838442653418,-0.063342787325382233,-0.02131335437297821,0.017497057095170021,0.01884775422513485,-0.058019179850816727,-0.047967333346605301,-0.011339805088937283,-0.0061679715290665627,0.0016081464709714055,-0.013189368881285191,0.0076800351962447166,-0.025583324953913689,-0.085355885326862335,-0.032446898519992828,0.018796775490045547,-0.034577321261167526,0.013762791641056538,0.014290008693933487,0.014173121191561222,-0.010033689439296722,0.021499067544937134,0.036250781267881393,0.033960428088903427,-0.049966897815465927,0.028620179742574692,0.0096308980137109756,-0.021925762295722961,0.023637156933546066,-0.04198041558265686,0.0065857572481036186,0.068010248243808746,-0.033089358359575272,-0.046330809593200684,0.0072623030282557011,-0.05602853000164032,0.033150721341371536,0.031560763716697693,-0.01187676377594471,-0.018638428300619125,-0.020238412544131279,-0.024820592254400253,-0.043594889342784882,-0.032681196928024292,0.019255863502621651,-0.0029854602180421352,0.012457914650440216,0.021088074892759323,-0.021242406219244003,-0.0035756679717451334,0.023545963689684868,-0.016992086544632912,-0.040703203529119492,0.019838655367493629,0.035102758556604385,0.0038775885477662086,-0.0089459074661135674,-0.062551341950893402,0.0286526158452034,0.019785553216934204,0.029963595792651176,0.020708153024315834,0.0084406649693846703,0.014521330595016479,-0.014454536139965057,-0.0027052685618400574,-0.0051593296229839325,-0.0029745330102741718,-0.051032260060310364,0.018031150102615356,-0.00051169580547139049,-0.010161793790757656,-0.020598459988832474,-0.023619439452886581,-0.0031150926370173693,0.030576728284358978,0.026901835575699806,0.0044231526553630829,-0.011513193137943745,-0.015979764983057976,-0.066932469606399536,-0.029561739414930344,0.046079151332378387,0.028945429250597954,-0.012297495268285275,-0.017479389905929565,0.020069124177098274,-0.011080208234488964,-0.022577129304409027,-0.077613554894924164,0.033696763217449188,-0.032863005995750427,0.032931387424468994,0.041710495948791504,-0.006196965929120779,0.025460571050643921,0.068342350423336029,-0.014376956969499588,0.0068385014310479164,-0.0096058109775185585,0.022971225902438164,0.017439981922507286,0.0070765987038612366,-0.036399789154529572,-0.064376123249530792,-0.031202236190438271,0.0024694534949958324,-0.014917734079062939,-0.0078333104029297829,0.05481841042637825,-0.0377979576587677,0.055253375321626663,0.020646411925554276,-0.0027613460551947355,0.011262465268373489,-0.070542111992835999,0.020346548408269882,-0.030290158465504646,-0.024588532745838165,0.014817512594163418,-0.030341679230332375,0.016599278897047043,-0.020862270146608353,-0.0042871278710663319,0.012190588749945164,0.015122895129024982,-0.024842657148838043,0.034316569566726685,0.0053437701426446438,-0.028008680790662766,-0.00018976612773258239,0.0056765871122479439,0.022749710828065872,-0.018906226381659508,0.026007154956459999,-0.0021915480028837919,0.00087565171997994184,-0.016170129179954529,0.012972299940884113,-0.013601932674646378,0.0016958508640527725,-0.022277344018220901,-0.045854885131120682,-0.041525453329086304,0.01537117175757885,-0.0045974948443472385,0.04806160181760788,-0.020666027441620827,0.018059628084301949,-0.038664169609546661,-0.035695962607860565,-0.0066226408816874027,-0.02943437360227108,0.020551495254039764,-0.0030611595138907433,0.031446725130081177,0.025979109108448029,0.0075615779496729374,0.0058630723506212234,-0.027851291000843048,0.037977881729602814,0.042648814618587494,-0.02704615518450737,-0.018637221306562424,-0.020610813051462173,0.036014106124639511,-0.013162214308977127,-0.009692060761153698,-0.023033065721392632,-0.052962765097618103,-0.0058682961389422417,0.0021006069146096706,0.001364866504445672,-0.087702751159667969,-0.0021915014367550611,-0.014931130222976208,0.022302065044641495,0.060312427580356598,0.011052282527089119,-0.018445136025547981,0.010843915864825249,0.0085382843390107155,-0.02028496190905571,-0.051291920244693756,0.035864096134901047,-0.049740653485059738,-0.029765943065285683,0.07417009025812149,0.054398722946643829,0.020051242783665657,-0.062384933233261108,-0.036648236215114594,-0.038736693561077118,0.0031791841611266136,-0.059476837515830994,0.036623869091272354,-0.024058682844042778,-0.042851690202951431,0.028707314282655716,0.013207315467298031,-0.011205289512872696,0.0027720921207219362,-0.029565867036581039,-0.057698044925928116,-0.030240327119827271,-0.020874045789241791,-0.033596526831388474,0.0031199273653328419,-0.016843490302562714,-0.017977045848965645,0.0063940607942640781,-0.0055252551101148129,-0.034707576036453247,0.0017622781451791525,0.027456939220428467,0.01643604040145874,0.033375781029462814,0.030785344541072845,-0.0058173802681267262,-0.0070444401353597641,-0.031636156141757965,-0.027863940224051476,0.022928304970264435,-0.0033079965505748987,0.0081552322953939438,-0.016367670148611069,0.056014854460954666,0.025541501119732857,-0.029130116105079651,0.0081231733784079552,0.014719116501510143,0.02644059993326664,-0.010696054436266422,-0.056739009916782379,-0.039745382964611053,0.030119581148028374,-0.028576498851180077,0.068510852754116058,0.0096171554177999496,-0.013680344447493553,-0.0034130050335079432,0.057621777057647705,-0.0095278015360236168,0.01898820698261261,-0.010850407183170319,-0.022498572245240211,-0.044652622193098068,-0.017299208790063858,-0.045014224946498871,-0.0017761009512469172,0.037407919764518738,-0.026212679222226143,-0.034595023840665817,-0.039043989032506943,-0.0067883874289691448,0.051337692886590958,-0.014387921430170536,0.02338874526321888,0.048023615032434464,0.018034707754850388,0.032932858914136887,-0.040568474680185318,0.0089061465114355087,-0.003762182779610157,0.016926757991313934,0.023101422935724258,0.020364733412861824,0.03419620543718338,0.037020005285739899,-0.014314360916614532,0.043308965861797333,0.01017338689416647,-0.035163506865501404,0.043253254145383835,0.0023047910071909428,-0.0096484711393713951,0.01949017308652401,0.02919323556125164,-0.032470971345901489,-0.0038531168829649687,-0.053622867912054062,0.005406268872320652,-0.032470524311065674,-0.037286531180143356,0.072133809328079224,0.0023042575921863317,0.036488402634859085,0.01278962567448616,0.029446294531226158,0.0045752036385238171,-0.021338250488042831,-0.027799606323242188,-0.043357118964195251,-0.0052308780141174793,0.020190104842185974,0.041515998542308807,0.024452861398458481,-0.051470097154378891,-0.013721473515033722,-0.013640792109072208,-0.0696277916431427,0.039365790784358978,0.014045346528291702,0.064822301268577576,-0.010870217345654964,0.043809697031974792,-0.006837683729827404,-0.0046686921268701553,0.018310990184545517,-0.0017084304708987474,-0.092980965971946716,0.033733643591403961,-0.04330097883939743,0.0073313522152602673,-0.026475865393877029,-0.021890195086598396,-0.050702322274446487,0.0016263991128653288,-0.013285654596984386,-0.0027298582717776299,-0.012399721890687943,-0.0092727635055780411,0.0026617634575814009,0.0058298897929489613,0.010973111726343632,0.032736044377088547,0.062721684575080872,-0.0025113301817327738,0.018743010237812996,0.013208549469709396,0.017254326492547989,-0.0091636860743165016,0.051861107349395752,0.053920913487672806,0.06100122258067131,0.027633292600512505,0.029685890302062035,-0.0015534744597971439,-0.0053166742436587811,-0.013068423606455326,0.039394378662109375,0.026499917730689049,-0.015020167455077171,0.079864330589771271,0.007131979800760746,-0.016550421714782715,-0.01049573440104723,-0.0051016844809055328,0.030062999576330185,-0.049115784466266632,-0.050153840333223343,-0.043880466371774673,-0.0079406360164284706,0.0047988253645598888,-0.015606825239956379,0.029065923765301704,-0.03071257472038269,-0.014355367980897427,-0.027686618268489838,0.01387975737452507,0.033434007316827774,-0.059077132493257523,0.034456230700016022,0.035158634185791016,0.015295837074518204,-0.054806545376777649,-0.023978672921657562,0.017288248986005783,0.0068887234665453434,-0.040278986096382141,0.014749782159924507,-0.00067667337134480476,0.047151681035757065,0.021269951015710831,0.027942810207605362,-0.024583632126450539,0.044587161391973495,0.02542542852461338,0.0019426521612331271,0.04868682473897934,0.016162268817424774,-0.024863839149475098,-0.009667474776506424,0.0037633215542882681,0.020361660048365593,-0.082694739103317261,-0.05677143856883049,-0.02448393777012825,0.018761182203888893,-0.048523273319005966,-0.010252702049911022,0.048510666936635971,0.019866719841957092,-0.045239143073558807,0.035839080810546875,-0.019609022885560989,-0.046852428466081619,-0.033149279654026031,0.023871725425124168,0.0052872360683977604,0.022944319993257523,0.018599346280097961,0.0033578244037926197,0.0062108933925628662,-0.028152113780379295,-0.012236480601131916,0.014833695255219936,0.0053512551821768284,-0.0018891794607043266,0.061694175004959106,-0.061769414693117142,0.024850867688655853,-0.045567475259304047,-0.041179385036230087,0.012917756102979183,-0.050252068787813187,0.0027475559618324041,0.0079506728798151016,0.00078508653677999973,0.018757639452815056,-0.01869288831949234,-0.033765997737646103,-0.0013793687103316188,0.033133219927549362,0.03151264414191246,0.013297613710165024,0.035638436675071716,0.046805165708065033,-0.0068973074667155743,-0.059340257197618484,0.0077871084213256836,-0.010225308127701283,0.0049929632805287838,0.0027993745170533657,-0.003160861786454916,0.032686974853277206,0.0083788111805915833,-0.040972035378217697,-0.087841719388961792,-0.020943712443113327,0.05422641709446907,-0.023515613749623299,0.0079040052369236946,-0.073364555835723877,-0.036091148853302002,-0.01571294292807579,-0.020930763334035873,-0.044216271489858627,-0.0014458452351391315,-0.020315742120146751,0.036630041897296906,0.043490592390298843,-0.013631015084683895,0.024126498028635979,-0.025845309719443321,-0.050681382417678833,-0.0010221134871244431,-0.034881051629781723,0.069606110453605652,-0.0083951372653245926,-0.01611042395234108,-0.030203720554709435,-0.00068954832386225462,0.010824448429048061,-0.0036122340243309736,-0.05491093173623085,-0.0032950465101748705,-0.041338909417390823,-0.030088489875197411,0.0056872265413403511,0.054115094244480133,-0.036958713084459305,-0.053339313715696335,-0.046314679086208344,-0.018231602385640144,0.024864742532372475,0.038482651114463806,-0.013012457638978958,0.039581518620252609,0.019831188023090363,-0.0033896395470947027,0.001129993237555027,0.054992847144603729,0.026618301868438721,0.014818972907960415,0.038261037319898605,-0.010824797675013542,0.0075353719294071198,-0.060562778264284134,-0.0098104355856776237,-0.0083359489217400551,-0.0086518852040171623,-0.0013713057851418853,0.028061287477612495,-0.02420889213681221,0.0067000491544604301,0.012899226509034634,-0.049959942698478699,0.047231875360012054,-0.0099271070212125778,0.029375039041042328,0.015159880742430687,0.030555959790945053,0.0016544942045584321,-0.029311161488294601,-0.038863036781549454,0.034449681639671326,-0.0062634050846099854,0.014423899352550507,-0.027107536792755127,0.0090715689584612846,-0.0060235657729208469,-0.027260366827249527,-0.028102077543735504,-0.0024116986896842718,-0.006752286572009325,0.030060220509767532,0.001091973390430212,-0.024573372676968575,-0.064762987196445465,0.0044742017053067684,0.041637491434812546,0.006822837982326746,-0.0027539399452507496,-0.04244883731007576,-0.05788080021739006,-0.044639952480792999,0.024765314534306526,-0.034614801406860352,0.0035802866332232952,-0.012944410555064678,0.028751611709594727,-0.021419614553451538,-0.0055294511839747429],"face_num":1,"landmark_num":105,"pose":[10.426637649536133,-4.4992427825927734,-0.58456879854202271],"face_prob":[1.0],"landmark":[799.2508544921875,1096.208740234375,1240.654296875,1094.9720458984375,1017.4330444335938,998.57861328125,1019.7756958007812,1073.234375,856.2061767578125,1035.13671875,933.8515625,1003.8469848632812,1100.0830078125,1011.6668701171875,1179.436767578125,1038.3056640625,872.8338623046875,1087.581298828125,945.71942138671875,1074.416015625,1093.3974609375,1081.538818359375,1166.590576171875,1092.97607421875,1493.1463623046875,1106.8787841796875,1803.4925537109375,1122.54248046875,1661.3282470703125,1008.6871948242188,1651.0706787109375,1079.126953125,1537.4063720703125,1056.8326416015625,1597.4547119140625,1028.1773681640625,1726.907470703125,1018.4874267578125,1778.471435546875,1060.5947265625,1546.176025390625,1099.3516845703125,1597.8970947265625,1085.4248046875,1704.5565185546875,1081.686279296875,1754.29541015625,1101.360595703125,950.329833984375,1237.64794921875,1183.385009765625,1267.03759765625,977.181396484375,1217.33203125,1007.8623046875,1203.468505859375,1040.79296875,1196.4024658203125,1074.479736328125,1197.28076171875,1107.569091796875,1203.653076171875,1138.1513671875,1217.7967529296875,1163.763427734375,1239.65087890625,972.8101806640625,1259.625244140625,999.7427978515625,1275.834716796875,1029.82177734375,1285.0888671875,1060.949951171875,1289.74853515625,1092.414306640625,1290.66357421875,1123.592041015625,1286.35107421875,1154.080322265625,1278.5302734375,1505.3389892578125,1268.0709228515625,1708.0179443359375,1249.576416015625,1518.981201171875,1239.8076171875,1538.6033935546875,1215.315185546875,1567.039306640625,1202.20703125,1598.1136474609375,1198.019775390625,1629.2843017578125,1201.669677734375,1659.324462890625,1210.7451171875,1686.067138671875,1227.1563720703125,1530.2646484375,1279.018310546875,1556.6688232421875,1285.6533203125,1583.6409912109375,1289.33984375,1610.8587646484375,1289.97509765625,1638.017578125,1288.05908203125,1664.3843994140625,1281.280517578125,1688.3682861328125,1268.41259765625,1356.669921875,1282.080322265625,1408.8363037109375,1560.64453125,1382.7197265625,1421.0,1381.5010986328125,1632.008056640625,1219.308349609375,1626.333251953125,1504.8509521484375,1610.831787109375,1130.4825439453125,1834.1395263671875,1509.7669677734375,1838.226318359375,1168.39501953125,1840.3800048828125,1477.0972900390625,1842.334228515625,1356.515380859375,1776.99951171875,1318.5791015625,1763.8675537109375,1391.8681640625,1763.096435546875,1223.385498046875,1796.4013671875,1458.71044921875,1788.520751953125,1175.30078125,1811.2015380859375,1270.33349609375,1778.24560546875,1426.817626953125,1771.79443359375,1487.899169921875,1809.6094970703125,1339.509521484375,1975.9508056640625,1215.365234375,1935.4556884765625,1444.841064453125,1933.088623046875,1168.38525390625,1888.6160888671875,1273.85400390625,1966.6778564453125,1396.037353515625,1963.970703125,1483.1046142578125,1889.708984375,1350.7132568359375,1842.592041015625,1342.6649169921875,1877.176025390625,1259.4251708984375,1840.41455078125,1253.5074462890625,1868.7591552734375,1413.9844970703125,1838.3511962890625,1413.215087890625,1872.574462890625,1213.9150390625,1836.5245361328125,1210.5072021484375,1855.8992919921875,1305.033935546875,1843.0133056640625,1297.79638671875,1876.015380859375,1382.399658203125,1841.2255859375,1378.171142578125,1878.257080078125,1445.6971435546875,1837.94091796875,1446.6396484375,1860.6153564453125,622.818603515625,1224.1640625,1785.5914306640625,1214.9752197265625,1357.4207763671875,2194.99365234375,768.70306396484375,1845.98193359375,1715.2325439453125,1736.135498046875,668.5491943359375,1537.0185546875,1775.165771484375,1473.250732421875,1036.9564208984375,2098.42333984375,1579.2042236328125,2001.826416015625],"request_id":"B3FA6B23-93CC-453C-BD11-C451E5BABED3","errno":0,"age":[26],"glass":[0],"iris":[1071.598876953125,1235.034912109375,51.706081390380859,1573.8760986328125,1241.315673828125,51.706081390380859],"gender":[0],"face_rect":[679,539,1172,1664],"dense_fea_len":1024},"RequestId":"B3FA6B23-93CC-453C-BD11-C451E5BABED3","Success":true}
---------------------------------------
{"Data":{"rectA":[679,539,1172,1664],"err_msg":"","thresholds":[60.03,67.05,75.45],"rectB":[208,103,152,218],"request_id":"EE58999F-40BD-4DCD-9A84-ED13FC7CFFBC","errno":0,"confidence":0.5912908},"RequestId":"EE58999F-40BD-4DCD-9A84-ED13FC7CFFBC","Success":true}
1:N 功能测试:
{"Data":"ok","RequestId":"81A31B84-DD9D-449A-9485-A850419B5517","Success":true}
{"RequestId":"AC4CD44D-D39C-4E52-85CB-2EBDB39C6AC6","HostId":"face.cn-shanghai.aliyuncs.com","Code":"AddImageError","Message":"Error 1062: Duplicate entry 'default1-LiuYifei-photo2' for key 'img_idx'"}
{"Data":["default","default1"],"RequestId":"8868B137-A45F-4782-A41A-AC1D12A9A4F4","Success":true}
{"Data":{"mark":0,"list":[{"person":"LiuYifei","image":"photo1"},{"person":"LiuYifei","image":"photo2"}]},"RequestId":"BE5EA6DA-6F0E-4B82-90A5-7258B576ECF5","Success":true}
{"Data":[{"person":"LiuYifei","score":0.9999998,"image":"photo3","rect":[146,131,132,179]}],"RequestId":"E18E43C7-B713-4A20-9F05-B8F6A74CD1C8","Success":true}
{"Data":"ok","RequestId":"DB7F305E-CDB7-4F84-8817-9B92705E6F6F","Success":true}
{"Data":{"mark":0,"list":[{"person":"LiuYifei","image":"photo2"}]},"RequestId":"48F50207-AA51-4B8A-B9D2-AB6ADB02E1A0","Success":true}

更多参考

人脸查找1:N API调用说明
阿里云人脸识别综述

版权声明:本文中所有内容均属于阿里云开发者社区所有,任何媒体、网站或个人未经阿里云开发者社区协议授权不得转载、链接、转贴或以其他方式复制发布/发表。申请授权请邮件developerteam@list.alibaba-inc.com,已获得阿里云开发者社区协议授权的媒体、网站,在转载使用时必须注明"稿件来源:阿里云开发者社区,原文作者姓名",违者本社区将依法追究责任。 如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件至:developer2020@service.aliyun.com 进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章