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

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

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

简介: 本篇博客是对前面多语言开发阿里云新版人脸识别的续,主要介绍使用NODE JS SDK调用人脸识别的接口。

概述

本篇博客是对前面多语言开发阿里云新版人脸识别的续,主要介绍使用NODE JS SDK调用人脸识别的接口。

操作步骤

1、SDK安装:openapi-core-nodejs-sdk

npm install @alicloud/pop-core -S

2、示例代码:

var RPCClient = require('@alicloud/pop-core').RPCClient;

var client = new RPCClient({
  accessKeyId: '******',
  accessKeySecret: '******',
  endpoint: 'https://face.cn-shanghai.aliyuncs.com',
  apiVersion: '2018-12-03'
});

 // DetectFace API 人脸检测定位
function DetectFace(ImageUrl_1)
{
    var params = {'ImageUrl':ImageUrl_1};
    var action = 'DetectFace';
    var requestOption = {
        method: 'POST'
    }

    client.request(action, params, requestOption).then((result) => {
    console.log(JSON.stringify(result));
    }, (ex) => {
    console.log(ex);
    })
}

 // GetFaceAttribute API 人脸属性识别
function GetFaceAttribute(ImageUrl_1)
{
    var params = {'ImageUrl':ImageUrl_1};
    var action = 'GetFaceAttribute';
    var requestOption = {
        method: 'POST'
    }

    client.request(action, params, requestOption).then((result) => {
    console.log(JSON.stringify(result));
    }, (ex) => {
    console.log(ex);
    })
}

 // GetFaceAttribute API 人脸属性识别
function VerifyFace(ImageUrl_1,ImageUrl_2)
{
    var params = {'ImageUrl1':ImageUrl_1, 'ImageUrl2':ImageUrl_2};
    var action = 'VerifyFace';
    var requestOption = {
        method: 'POST'
    }

    client.request(action, params, requestOption).then((result) => {
    console.log(JSON.stringify(result));
    }, (ex) => {
    console.log(ex);
    })
}


 // VerifyFace API 人脸比对
function VerifyFace(ImageUrl_1,ImageUrl_2)
{
    var params = {'ImageUrl1':ImageUrl_1, 'ImageUrl2':ImageUrl_2};
    var action = 'VerifyFace';
    var requestOption = {
        method: 'POST'
    }

    client.request(action, params, requestOption).then((result) => {
    console.log(JSON.stringify(result));
    }, (ex) => {
    console.log(ex);
    })
}



 // AddFace接口用于向人脸库中添加人脸
function AddFace(groupName, person, image, imageUrl)
{
    var params = {'Group':groupName, 'Person':person, 'image':image, 'imageUrl':imageUrl};
    var action = 'AddFace';
    var requestOption = {
        method: 'POST'
    }

    client.request(action, params, requestOption).then((result) => {
    console.log(JSON.stringify(result));
    }, (ex) => {
    console.log(ex);
    })
}


 // DeleteFace接口用于从人脸库中删除人脸
function DeleteFace(groupName, person, image)
{
    var params = {'Group':groupName, 'Person':person, 'Image':image};
    var action = 'DeleteFace';
    var requestOption = {
        method: 'POST'
    }

    client.request(action, params, requestOption).then((result) => {
    console.log(JSON.stringify(result));
    }, (ex) => {
    console.log(ex);
    })
}

 // ListFace接口用于列举注册库中的人脸
function ListFace(groupName)
{
    var params = {'Group':groupName};
    var action = 'ListFace';
    var requestOption = {
        method: 'POST'
    }

    client.request(action, params, requestOption).then((result) => {
    console.log(JSON.stringify(result));
    }, (ex) => {
    console.log(ex);
    })
}

 // ListGroup接口用于列举人脸组
function ListGroup()
{
    var params = {};
    var action = 'ListGroup';
    var requestOption = {
        method: 'POST'
    }

    client.request(action, params, requestOption).then((result) => {
    console.log(JSON.stringify(result));
    }, (ex) => {
    console.log(ex);
    })
}

 // RecognizeFace接口用于查找注册库中的人脸
function RecognizeFace(recognizeFaceImageUrl, groupName)
{
    var params = {'Group':groupName, 'ImageUrl':recognizeFaceImageUrl};
    var action = 'RecognizeFace';
    var requestOption = {
        method: 'POST'
    }

    client.request(action, params, requestOption).then((result) => {
    console.log(JSON.stringify(result));
    }, (ex) => {
    console.log(ex);
    })
}


// 参数设置
var image = new Object();
image.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';
image.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';
image.groupName = 'defaultjsdemo';
image.person = 'LiuYiFei';
image.image_1 = 'photo1';
image.image_2 = 'photo2';
image.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';


// 基础方法测试
DetectFace(image.imageUrl_1);
GetFaceAttribute(image.imageUrl_2);
VerifyFace(image.imageUrl_1, image.imageUrl_2);

// 1:N方法测试
//添加入两张人脸
AddFace(image.groupName, image.person, image.image_1, image.imageUrl_1);
AddFace(image.groupName, image.person, image.image_2, image.imageUrl_2);

//列举Group
ListGroup();

//列举Faces
ListFace(image.groupName);

//人脸查询
RecognizeFace(image.recognizeFaceImageUrl);

//删除Face
DeleteFace(image.groupName, image.person, image.image_1)

//列举Faces查询删除情况
ListFace(image.groupName)

3、测试结果

{"Data":"[]","RequestId":"926CA814-CD05-4BBB-9120-4E5FC1B9F0A5","Success":true}
{"Data":["default","default1","defaultPython","defaultPythonDemo1","defaultPythonDemo2","defaultjs"],"RequestId":"FB302E3A-9219-401D-A432-F82B932166D7","Success":true}
{"Data":"ok","RequestId":"5A63DE90-D0A2-4ADF-8DAC-BEB1BF8CD2BB","Success":true}
{"Data":{"mark":0,"list":[]},"RequestId":"E6DB9A52-B7DB-4273-83BF-BBA950E2F301","Success":true}
{"Data":{"mark":0,"list":[]},"RequestId":"57A70054-2D5C-4B40-A1AD-4290E99554F4","Success":true}
{"Data":"ok","RequestId":"FFB0409C-1241-4DC1-BFC9-F2A0596DA644","Success":true}
{"Data":{"expression":[0],"dense_fea":["0.032727491110563278","-0.0082056038081645966","-0.029683364555239677","-0.0096274437382817268","-0.0062350276857614517","-0.0026448068674653769","-0.0067025707103312016","-0.042322065681219101","-0.032813072204589844","0.066940806806087494","-0.031563118100166321","-0.034121245145797729","0.032720323652029037","0.018700320273637772","0.040912583470344543","-0.013406608253717422","0.0017285562353208661","-0.016166945919394493","0.014212021604180336","0.010660518892109394","0.0084707122296094894","0.036787349730730057","0.0049957362934947014","-0.038922004401683807","0.0094015710055828094","0.0068221860565245152","-0.010362580418586731","0.06648186594247818","0.056468170136213303","-0.0043498380109667778","-0.022770209237933159","-0.014392802491784096","0.0077355997636914253","0.010461430065333843","-0.0079089095816016197","0.0020622825250029564","-0.041936200112104416","-0.044677924364805222","0.047330934554338455","-0.026108806952834129","-0.027621025219559669","0.0089288912713527679","-0.0065221991389989853","0.01732107438147068","-0.014468864537775517","0.024791350588202477","-0.020587733015418053","0.010181466117501259","0.036107007414102554","-0.032575067132711411","-0.026263736188411713","0.019539019092917442","-0.021295515820384026","0.010360166430473328","0.0016431875992566347","0.06313817948102951","0.042572718113660812","0.03725554421544075","-0.028425950556993484","-0.0089646400883793831","-0.061609700322151184","-0.0052227862179279327","-0.046197503805160522","-0.0054872077889740467","0.0029128233436495066","0.0020342939533293247","-0.046985208988189697","-0.026900548487901688","0.027349323034286499","-0.023508371785283089","0.0081287696957588196","0.027452105656266212","0.02855827659368515","-0.013083036988973618","-0.0035784775391221046","-0.018154701218008995","0.0083623556420207024","-0.0092102736234664917","-0.0089603736996650696","-0.032652441412210464","0.023708861321210861","-0.025407390668988228","-0.03506232425570488","-0.04786122590303421","-0.014871174469590187","0.012019175104796886","0.010737509466707706","-0.046481531113386154","-0.0056934473104774952","0.044521350413560867","-0.011273238807916641","0.046886146068572998","0.022450640797615051","-0.033565357327461243","-0.011120734736323357","0.0014232759131118655","-0.058901343494653702","0.020882824435830116","-0.010866828262805939","0.0090104863047599792","-0.00057380337966606021","-0.014375720173120499","-0.053915120661258698","-0.0061579332686960697","0.019850153475999832","-0.033566128462553024","-0.013014300726354122","-0.052159529179334641","-0.021410537883639336","-0.0085521265864372253","-0.049211077392101288","0.067557960748672485","0.035185251384973526","-0.022767061367630959","-0.043442249298095703","-0.0052431798540055752","0.015893742442131042","0.045664872974157333","-0.031942319124937057","-0.00074889359530061483","0.046309478580951691","0.00091387249995023012","0.063510186970233917","-0.0079166032373905182","-0.0045268642716109753","-0.015213570557534695","0.021366933360695839","-0.0077703846618533134","-0.064481168985366821","-0.012182059697806835","0.063210204243659973","0.084716908633708954","-0.0050023403018712997","0.038193397223949432","-0.015867570415139198","0.01632281020283699","-0.0023937516380101442","-0.04451240599155426","0.033330444246530533","0.022885987535119057","-0.032544106245040894","0.03949272632598877","0.024744128808379173","-0.01038001012057066","0.05127725750207901","-0.007178653497248888","-0.010036447085440159","-0.070052273571491241","0.031381193548440933","0.014356805011630058","0.0029588059987872839","-0.0014321212656795979","0.024616777896881104","0.030502144247293472","0.03151397779583931","-0.054944872856140137","0.030372882261872292","-0.0035075908526778221","0.016011824831366539","-0.018013752996921539","0.014645944349467754","0.033703472465276718","0.020615382120013237","0.027796020731329918","-0.031960692256689072","0.042153723537921906","-0.030343839898705482","-0.02333701029419899","0.0036092991940677166","-0.022617140784859657","-0.044740431010723114","0.0068169734440743923","0.084661900997161865","-0.0082268845289945602","0.040676828473806381","0.019026700407266617","-0.027249863371253014","-0.029363946989178658","0.015378783456981182","-0.0024228759575635195","-0.022562388330698013","-0.04174315556883812","0.024250801652669907","-0.0094145471230149269","-0.05077781155705452","0.039274528622627258","-0.024050261825323105","0.042341619729995728","-0.026512054726481438","0.0081801777705550194","-0.0082026226446032524","-0.020809710025787354","-0.026034515351057053","0.012876772321760654","-0.011858414858579636","0.041344195604324341","-0.024697611108422279","0.015826383605599403","0.029146991670131683","0.00238022580742836","0.023530831560492516","0.0072940695099532604","0.027438625693321228","0.028963340446352959","0.024631103500723839","0.016460182145237923","-0.065476454794406891","0.042786069214344025","0.0271168053150177","-0.057292800396680832","0.043653130531311035","0.074018895626068115","-0.0091790929436683655","-0.014613390900194645","0.0022603068500757217","-0.00019762525334954262","0.0049971179105341434","-0.049047805368900299","0.023501202464103699","-0.017124656587839127","-0.0048491908237338066","-0.040060512721538544","0.030361125245690346","0.015514104627072811","-0.053992427885532379","0.052400439977645874","-0.027191024273633957","0.058834806084632874","0.036906398832798004","-0.014876607805490494","-0.051117785274982452","-0.052880581468343735","-0.019887847825884819","0.047327734529972076","-0.00016945738752838224","-0.018038613721728325","-0.011923404410481453","-0.054329086095094681","0.011504023335874081","-0.0017099310643970966","0.029220625758171082","-0.064924940466880798","-0.0076835337094962597","0.0060995211824774742","-0.0068181096576154232","-0.035507075488567352","-0.038002591580152512","-0.0012365642469376326","-0.030401742085814476","0.037892065942287445","-0.029295492917299271","0.002066844841465354","-0.040761590003967285","0.027784306555986404","0.0038503867108374834","0.014547655358910561","-0.050277773290872574","0.028280757367610931","-0.039480000734329224","0.038627125322818756","-0.0032416451722383499","0.007306195329874754","0.027227476239204407","-0.0028274916112422943","0.025762917473912239","-0.0031099556945264339","-0.06467244029045105","-0.046773802489042282","0.032679948955774307","-0.018184738233685493","-0.024781227111816406","-0.0069784428924322128","0.00089093140559270978","0.062452122569084167","0.044173218309879303","0.0066016726195812225","-0.072789773344993591","0.023462163284420967","-0.016921607777476311","0.017385445535182953","-0.013915834948420525","0.0025634875055402517","-0.041091151535511017","-0.011095141060650349","-0.027008412405848503","0.038381148129701614","-0.048599909991025925","-0.0063493824563920498","-0.053502358496189117","0.026816114783287048","-0.033505089581012726","-0.022248184308409691","-0.024954341351985931","-0.044203903526067734","-0.026957899332046509","0.043298076838254929","0.028161212801933289","0.029459306970238686","0.037935122847557068","0.0065484964288771152","-0.044354118406772614","-0.07473040372133255","0.039553165435791016","0.0095864236354827881","-0.059480719268321991","-0.047296062111854553","0.011953113600611687","-0.010029276832938194","-0.014672596007585526","-0.019205963239073753","0.0020607230253517628","-0.019253106787800789","-0.0094370609149336815","0.051314584910869598","-0.029539678245782852","-0.018402170389890671","-0.039998263120651245","-0.0085534974932670593","0.02207610197365284","0.049316775053739548","-0.015461069531738758","0.0072634825482964516","-0.041865836828947067","-0.0068650548346340656","0.013807328417897224","-0.0037389222998172045","-0.044770490378141403","0.0068881921470165253","0.021339572966098785","0.0051484955474734306","-0.02549155056476593","0.060375645756721497","0.020760152488946915","0.039136577397584915","0.0062082237564027309","-0.051224749535322189","-0.051565311849117279","0.013782820664346218","-0.029110178351402283","0.015260511077940464","0.031988389790058136","0.040680401027202606","0.030093535780906677","-0.036548495292663574","0.034533791244029999","0.04699389636516571","-0.017273101955652237","0.021868310868740082","-0.0054267714731395245","-0.046487264335155487","-0.011321754194796085","0.02054104395210743","0.027594607323408127","-0.023689284920692444","0.012154912576079369","-0.0041120485402643681","-0.0091637428849935532","0.0031583709642291069","0.010620936751365662","-0.0050705983303487301","-0.022322854027152061","-0.022065106779336929","0.023746704682707787","-0.014495838433504105","-0.012354140169918537","-0.046505138278007507","0.021199852228164673","-0.003941674716770649","-0.027136176824569702","0.0041805468499660492","-0.04115397110581398","0.037554427981376648","0.0012104058405384421","0.032513342797756195","0.074414238333702087","-0.027278497815132141","-0.010119883343577385","0.022009281441569328","0.029538961127400398","0.01640663854777813","-0.06663978099822998","-0.032937303185462952","0.026348160579800606","-0.019124025478959084","0.034068647772073746","-0.061192914843559265","0.015296517871320248","0.03328096866607666","0.019865510985255241","0.048565272241830826","-0.050992920994758606","0.0074040954932570457","0.0087697599083185196","0.0038647772744297981","-0.015297834761440754","-0.023430531844496727","-0.032400269061326981","0.05222335085272789","-0.0063633900135755539","-0.035167720168828964","0.020548164844512939","-0.017314910888671875","0.072730444371700287","-0.020061800256371498","0.010379401966929436","0.0026712098624557257","0.024437058717012405","0.055597830563783646","0.028081094846129417","0.018453335389494896","-0.059673316776752472","0.016971325501799583","0.04643569141626358","-0.010773518122732639","-0.0074593145400285721","-0.036781959235668182","-0.028073292225599289","-0.021165020763874054","-0.053516577929258347","0.01389397494494915","0.053105935454368591","-0.012174703180789948","0.011300351470708847","0.0018182353815063834","0.032010648399591446","-0.014791670255362988","0.0036643785424530506","-0.0035601223353296518","0.00169432966504246","-0.0061322730034589767","-0.019261570647358894","-0.052761517465114594","0.0043331733904778957","-0.023405889049172401","-0.0013054362498223782","-0.038325980305671692","0.02234351821243763","-0.020316729322075844","-0.010952194221317768","-0.0026647683698683977","-0.017443280667066574","0.028862243518233299","-0.021959662437438965","-0.046642553061246872","0.0042391922324895859","-0.051883362233638763","0.011691072024405003","-0.038915291428565979","0.024683644995093346","-0.00091420498210936785","-0.0095504401251673698","-0.071193724870681763","0.013452977873384953","0.0035779622849076986","0.03549451008439064","0.018556013703346252","-0.027256513014435768","-0.024853691458702087","-0.013916970230638981","-0.012280788272619247","0.0021221304778009653","0.0022675865329802036","0.089058496057987213","0.0024201399646699429","-0.0048117740079760551","-0.0057366518303751945","0.025161929428577423","0.048330999910831451","0.015337476506829262","0.032063588500022888","-0.017362365499138832","0.0099482433870434761","0.05601823702454567","0.033268816769123077","-0.035882279276847839","-0.0047324257902801037","-0.03033473901450634","0.017119180411100388","-0.031441368162631989","-0.043387580662965775","-0.0052176737226545811","-0.019093003123998642","0.0083253029733896255","0.002182497177273035","-0.015315691940486431","-0.0050778258591890335","0.032804384827613831","-0.048603914678096771","0.018079707399010658","0.046641957014799118","0.0064123077318072319","-0.066496215760707855","-0.038945909589529037","0.0033663073554635048","0.0073735103942453861","-0.048868976533412933","-0.055136624723672867","-0.018187398090958595","-0.013666290789842606","-0.0086443210020661354","-0.0093931518495082855","0.0065682181157171726","-0.007914089597761631","-0.065493114292621613","-0.064873777329921722","0.023716287687420845","-0.011872446164488792","0.031232437118887901","0.037807673215866089","0.0015283311950042844","-0.022662173956632614","0.016465635970234871","-0.01046160701662302","0.042473223060369492","-0.0052532297559082508","-0.0066502504050731659","-0.014517301693558693","-0.021044084802269936","-0.030467977747321129","-0.071140803396701813","-0.027173178270459175","0.059272579848766327","-0.0013943332014605403","-0.020940547809004784","-0.004419941920787096","0.0063467551954090595","0.038910184055566788","0.052343174815177917","-0.028728863224387169","0.011732944287359715","0.021289363503456116","-0.055798493325710297","-0.038842339068651199","0.044947247952222824","0.02441762201488018","-0.0086776651442050934","-0.013388664461672306","-0.018683692440390587","-0.035569734871387482","0.034994121640920639","0.060199528932571411","0.0086821494624018669","-0.017897795885801315","-0.0097756162285804749","-0.0095259156078100204","-0.00026338250609114766","-0.035030871629714966","-0.036315254867076874","-0.0073267160914838314","0.017055833712220192","0.051266193389892578","0.026408467441797256","0.014815188944339752","0.0072418665513396263","-0.024581056088209152","0.010313536040484905","0.047205414623022079","-0.036138296127319336","-0.014613096602261066","0.0054184058681130409","0.015539579093456268","-0.066070429980754852","0.0057611675001680851","-0.09241090714931488","0.0052681951783597469","-0.0013419043971225619","-0.025752810761332512","0.017354480922222137","0.017572777345776558","-0.023573664948344231","-0.030024390667676926","-0.025660784915089607","-0.0097606591880321503","-0.015134649351239204","-0.015287980437278748","-0.037448316812515259","0.015478561632335186","-0.0031650506425648928","-0.030225794762372971","-0.052669156342744827","0.060206335037946701","0.002581301610916853","0.020695371553301811","0.080319158732891083","0.0037524488288909197","0.025013512000441551","0.047787081450223923","0.0025819775182753801","0.0090151699259877205","-0.020570492371916771","0.0095280185341835022","-0.020616816356778145","0.0091758361086249352","-0.051330067217350006","-0.07755511999130249","-0.027056649327278137","0.0050598271191120148","0.0080269621685147285","0.047498438507318497","-0.0065127392299473286","-0.018920017406344414","0.075119540095329285","0.027064692229032516","0.0098685622215270996","0.023606708273291588","-0.03257322683930397","0.053058046847581863","-0.027920423075556755","0.00035854836460202932","0.052203807979822159","-0.031770080327987671","0.031482268124818802","-0.014773235656321049","0.024185489863157272","-0.056658957153558731","0.0070734298788011074","-0.042002968490123749","0.0026305904611945152","-0.01066125649958849","-0.02896357886493206","-0.0097189359366893768","0.01806289330124855","0.011441475711762905","-0.021583143621683121","-0.0062351059168577194","-0.031566750258207321","-0.026066306978464127","0.020607396960258484","-0.0099304849281907082","0.0088631818071007729","-0.017030349001288414","0.008817954920232296","0.00080581952352076769","0.021539673209190369","0.080019652843475342","-0.044647373259067535","0.050556439906358719","0.0036073822993785143","0.014935029670596123","0.034807775169610977","-0.049796439707279205","0.026013633236289024","0.032238207757472992","0.043684955686330795","-0.015294336713850498","0.024539763107895851","-0.01375786866992712","0.033565491437911987","0.0022785014007240534","-0.040164928883314133","0.012193880043923855","0.027826111763715744","0.002673230366781354","-0.023367861285805702","-0.02036256343126297","0.042004961520433426","0.0038357332814484835","0.049248736351728439","-0.0051882411353290081","-0.06807437539100647","-0.027521789073944092","-0.0029114158824086189","-0.03517884761095047","-0.038478467613458633","0.037279251962900162","0.0086821820586919785","-0.024448931217193604","-0.019540539011359215","0.0057122469879686832","-0.0076289833523333073","-0.021654065698385239","-0.027560601010918617","-0.023471575230360031","0.024011405184864998","0.013374196365475655","-0.04415426030755043","-0.011496739462018013","0.035581722855567932","0.0057859714142978191","-0.0062058707699179649","-0.011432294733822346","-0.038295373320579529","-0.047548238188028336","-0.019009165465831757","0.015005804598331451","0.041029844433069229","-0.010155393742024899","0.012707005254924297","-0.010240664705634117","-0.016737030819058418","0.0079981070011854172","0.0082807037979364395","-0.029436081647872925","-0.027589751407504082","-0.02592683769762516","-0.0016054768348112702","-0.071674525737762451","0.028023211285471916","-0.0064964382909238338","0.018062267452478409","0.011560906656086445","-0.026482133194804192","-0.023755049332976341","0.0023532463237643242","-0.024099046364426613","0.013330161571502686","0.024465415626764297","-0.020662358030676842","0.026347488164901733","-0.022277431562542915","0.033949647098779678","-0.013070070184767246","0.045655395835638046","-0.040297545492649078","0.018975522369146347","0.020187631249427795","0.027368053793907166","0.038053307682275772","-0.052168838679790497","0.00088151468662545085","0.034813214093446732","-0.042671453207731247","-0.019810650497674942","-0.0063579748384654522","0.026508614420890808","-0.020700328052043915","-0.053222265094518661","0.029718711972236633","-0.0024248678237199783","-0.021839315071702003","-0.010701723396778107","0.012801217846572399","0.018886787816882133","0.016468903049826622","-0.0016970542492344975","-0.0043472792021930218","-0.025320351123809814","0.0058209355920553207","-0.081084705889225006","0.068614482879638672","0.0021080507431179285","-0.010501587763428688","-0.049483645707368851","0.00052624341333284974","-0.029110999777913094","0.080577857792377472","-0.016771377995610237","-0.021137911826372147","-0.041810102760791779","-0.02486821636557579","0.03684312105178833","0.016371838748455048","0.034965973347425461","0.008225511759519577","0.0023998210672289133","0.013391865417361259","0.034024644643068314","0.034535214304924011","0.016759524121880531","0.025518758222460747","0.0045380126684904099","0.02878396213054657","-0.024739610031247139","-0.0037357143592089415","-0.0023904652334749699","0.043193124234676361","0.043461542576551437","0.000040283695852849633","-0.025617847219109535","0.0041299057193100452","-0.060699097812175751","0.037842869758605957","-0.015292679890990257","-0.011860270984470844","0.088123701512813568","0.016280403360724449","0.052728578448295593","0.036744315177202225","-0.021208690479397774","-0.056602239608764648","-0.001976468600332737","-0.035609174519777298","-0.051893983036279678","0.013002173975110054","-0.0051866983994841576","-0.010878279805183411","0.0070363646373152733","-0.044179808348417282","-0.06872907280921936","0.0020061344839632511","-0.045914854854345322","0.043180864304304123","-0.0061019081622362137","0.031903322786092758","-0.021610813215374947","-0.0081337727606296539","0.023984275758266449","0.0088662989437580109","-0.023490181192755699","-0.0028303894214332104","-0.054698728024959564","0.014958614483475685","-0.0056156991049647331","-0.022438956424593925","-0.025739343836903572","-0.031840398907661438","0.00077713001519441605","-0.0057523529976606369","-0.042405609041452408","0.016883037984371185","0.018560146912932396","0.04644383117556572","-0.03052462637424469","-0.016234058886766434","0.017291849479079247","-0.0042335544712841511","0.042128607630729675","-0.040222696959972382","0.023533053696155548","0.0048290379345417023","-0.0097476188093423843","-0.0055055799894034863","0.028594024479389191","0.00072855543112382293","0.028764242306351662","0.050942540168762207","0.022638086229562759","0.021435284987092018","-0.0005695940344594419","0.016081757843494415","-0.014481873251497746","0.036004688590764999","-0.034099552780389786","0.0030469968914985657","0.027942223474383354","0.027207890525460243","0.0095733422785997391","-0.038510773330926895","-0.013104896061122417","-0.02916327491402626","-0.017403321340680122","-0.013296604156494141","-0.016401899978518486","0.052185434848070145","0.010420698672533035","0.030923010781407356","-0.0300751943141222","-0.038953818380832672","-0.035351544618606567","-0.020032968372106552","-0.022082541137933731","-0.014077621512115002","0.00022399239242076874","0.047364182770252228","0.032103966921567917","-0.036455824971199036","0.0085648326203227043","0.030359860509634018","0.052310824394226074","-0.0084916884079575539","0.026466822251677513","0.015032453462481499","-0.029854318127036095","-0.0065254089422523975","0.023966774344444275","0.004576604813337326","-0.0033361110836267471","0.01672772690653801","-0.014797544106841087","0.021931447088718414","-0.0052121975459158421","0.0046095335856080055","-0.01438327319920063","-0.010917562991380692","0.027919493615627289","-0.023236611858010292","-0.062245573848485947","-0.04013526439666748","0.041906032711267471","0.041407279670238495","-0.023554027080535889","0.021511130034923553","-0.043404370546340942","-0.0026499417144805193","-0.041216202080249786","-0.029359214007854462","0.037551391869783401","-0.00059818639419972897","-0.01370974350720644","0.0058054132387042046","0.057808864861726761","0.045188590884208679","-0.060475118458271027","-0.027690930292010307","-0.0035100486129522324","0.02102736197412014","0.013938862830400467","-0.042450759559869766","-0.019114959985017776","0.078232012689113617","-0.031545501202344894","0.036313947290182114","-0.038652390241622925","0.023972123861312866","0.012194412760436535","-0.015808112919330597","-0.021169558167457581","-0.015675438567996025","-0.016651056706905365","0.02302253432571888","-0.014751746319234371","-0.015032097697257996","0.0012104274937883019","0.047810785472393036","0.057774543762207031","-0.021574970334768295","0.025868307799100876","0.025900697335600853","-0.0185523871332407","-0.02425694465637207","0.02797565795481205","-0.0047021601349115372","-0.021062122657895088","-0.028223948553204536","0.050444405525922775","-0.034294776618480682","0.0066602947190403938","-0.025776168331503868","-0.046253081411123276","0.00043972829007543623","-0.012406874448060989","-0.037625629454851151","0.034667607396841049","-0.045398928225040436","0.050638966262340546","-0.027737339958548546","0.010657693259418011","-0.04967210441827774","0.020398490130901337","-0.013149539940059185","-0.0039252648130059242","-0.0014901369577273726","-0.0073957052081823349","0.034007392823696136","-0.026224648579955101","-0.040920611470937729","-0.012686158530414104","-0.036390345543622971","0.050277341157197952","0.022918028756976128","-0.0033539100550115108","0.0012007275363430381","-0.0040165791288018227","0.033601962029933929","0.0090254545211791992","-0.048045199364423752","-0.039490442723035812","-0.033135071396827698","0.00043357588583603501","0.017947107553482056","0.058827966451644897","-0.045226603746414185","-0.040601626038551331","-0.053124032914638519","-0.054107092320919037","0.024035947397351265","0.024969631806015968","-0.00035981391556560993","-0.023837065324187279","0.042570393532514572","-0.0049582221545279026","0.0099606448784470558","0.056517470628023148","0.02708711288869381","0.06416059285402298","0.038509547710418701","0.00062521605286747217","0.011677233502268791","-0.0031348331831395626","-0.013381070457398891","-0.040585294365882874","0.046590782701969147","0.030826400965452194","0.05109110102057457","-0.014557457529008389","-0.016682004556059837","-0.019985532388091087","-0.036794010549783707","0.049517348408699036","-0.0098937861621379852","-0.026719080284237862","-0.0052037942223250866","-0.023969285190105438","-0.029247002676129341","-0.056310702115297318","-0.050204575061798096","0.066085606813430786","-0.064198978245258331","0.016437070444226265","-0.0088326381519436836","-0.0073702842928469181","0.059009768068790436","-0.015872512012720108","-0.07865653932094574","-0.027243828400969505","-0.034644108265638351","0.025566987693309784","-0.040692847222089767","-0.014113320037722588","-0.045657414942979813","-0.051010046154260635","-0.036315567791461945","0.014999063685536385","-0.050846464931964874","-0.044098678976297379","-0.0070443986915051937","-0.0048666833899915218","-0.013374393805861473","-0.0053807883523404598","-0.015955813229084015","-0.0174064040184021","-0.015998169779777527","-0.0039422083646059036","-0.018468178808689117"],"face_num":1,"landmark_num":105,"pose":["22.396007537841797","-4.4076366424560547","-8.5078458786010742"],"face_prob":[1],"landmark":["235.93852233886719","181.224853515625",294.37744140625,"178.40582275390625","264.34829711914062","168.43838500976562","265.21820068359375","181.068603515625","244.18270874023438","174.37684631347656","253.68893432617188","169.44540405273438","274.91009521484375","170.20683288574219","285.31637573242188","172.76420593261719","245.7025146484375","181.55178833007812","255.45036315917969","180.93173217773438","274.9759521484375","180.59864807128906","284.71737670898438","179.86380004882812","318.85360717773438","174.85110473632812","348.05731201171875","165.13105773925781",331.5556640625,"160.9132080078125","333.79730224609375","171.04098510742188","321.5040283203125","168.97720336914062",326.29443359375,"164.64872741699219","337.69158935546875","158.89509582519531","344.01312255859375","160.14520263671875","323.97601318359375","174.20709228515625","328.93255615234375","172.76882934570312","338.48550415039062","168.87889099121094","343.42547607421875",167.390625,"255.98895263671875","197.39018249511719","284.51080322265625","196.33258056640625","259.40728759765625","195.14834594726562","263.135498046875","193.47883605957031","266.98919677734375","192.1165771484375",270.88916015625,"190.89151000976562","274.89813232421875","190.09413146972656","278.94927978515625","190.60324096679688","282.3414306640625","192.8724365234375","259.31668090820312","199.40296936035156","262.933837890625","200.82931518554688","266.71490478515625","201.73101806640625","270.58990478515625","202.03324890136719","274.47015380859375",201.78759765625,"278.2349853515625","200.81881713867188","281.65960693359375","198.9774169921875","324.36822509765625","192.35784912109375","346.50103759765625","183.86358642578125","325.71780395507812","189.13784790039062","327.86288452148438","186.38262939453125","330.47708129882812","184.0677490234375","333.50164794921875","182.32244873046875",336.78564453125,181.14013671875,340.26416015625,"180.99319458007812",343.625,"181.89608764648438","327.57489013671875","193.19772338867188","330.883544921875","193.38864135742188","334.1925048828125","193.19383239746094","337.42742919921875","192.47308349609375","340.51608276367188","191.27230834960938","343.3675537109375","189.6021728515625","345.39093017578125","186.98699951171875","307.93850708007812","195.653564453125","322.97787475585938","229.98866271972656","315.42767333984375","212.81187438964844","318.6104736328125","240.16804504394531","296.4090576171875","242.57423400878906","333.49383544921875","235.08760070800781","289.90362548828125","273.78512573242188","336.55206298828125","266.83981323242188","297.21453857421875","272.32388305664062","330.28485107421875","266.93109130859375","316.1566162109375","258.78811645507812","310.74346923828125","258.21832275390625","321.9896240234375","256.18374633789062","299.77841186523438","265.2615966796875","330.18899536132812","260.27825927734375","294.57672119140625","269.21646118164062","304.99990844726562","261.33135986328125",326.265625,"257.87847900390625","333.75286865234375","263.18707275390625","319.6361083984375","280.97247314453125","304.2489013671875","279.99725341796875","329.53201293945312","275.79522705078125","297.0303955078125","276.99725341796875","311.863525390625","281.74249267578125","325.07830810546875","279.33895874023438",333.28125,"271.50576782226562","316.33270263671875","266.66729736328125","317.069580078125","270.3067626953125","306.55950927734375",268.7802734375,"307.10260009765625","271.0684814453125","323.3345947265625","265.84170532226562","323.5369873046875","268.10223388671875","301.7786865234375","270.26226806640625","302.1114501953125","271.33126831054688",311.3896484375,"267.45767211914062","312.08770751953125","270.70928955078125",319.82177734375,"266.12884521484375","320.22772216796875","268.97854614257812","326.84783935546875","266.12237548828125","326.92303466796875","267.59002685546875","191.38597106933594","202.93789672851562","353.01336669921875","183.304443359375","324.28335571289062","316.0045166015625","229.84408569335938","290.48208618164062",354.11669921875,"249.325439453125","204.9068603515625","247.78366088867188","356.8758544921875","215.63363647460938","277.8021240234375","314.37930297851562","345.1080322265625","284.13601684570312"],"request_id":"8708EAB9-36C1-468E-BB79-EE82425DD23C","errno":0,"age":[25],"glass":[0],"iris":["275.29409790039062","195.13554382324219","5.8044281005859375","334.48928833007812","187.0887451171875","5.8044281005859375"],"gender":[0],"face_rect":[208,103,152,218],"dense_fea_len":1024},"RequestId":"8708EAB9-36C1-468E-BB79-EE82425DD23C","Success":true}
{"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,"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],"request_id":"4F6BBEF4-25D0-40E4-8EF8-FFBB6DADD991","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":"4F6BBEF4-25D0-40E4-8EF8-FFBB6DADD991","Success":true}
{"Data":"ok","RequestId":"045440B7-1073-41BE-8F33-764D59BDD6A1","Success":true}
{"Data":{"rectA":[679,539,1172,1664],"err_msg":"","thresholds":[60.03,67.05,75.45],"rectB":[208,103,152,218],"request_id":"CB3C7828-F3F9-4910-B350-52D8DC4C5CB3","errno":0,"confidence":0.5912908},"RequestId":"CB3C7828-F3F9-4910-B350-52D8DC4C5CB3","Success":true}

4、如果有使用本地图片的需求,可以提供请求中的:ImageUrl 为 Content,本地图片的处理可以参考:阿里云人脸识别NodeJS调用示例参考 本地图片处理方法。

参考链接

人脸查找1:N SDK调用说明
阿里云人脸识别NodeJS调用示例参考

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

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

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

其他文章