阿里云人脸识别Python3调用示例参考

简介: 本文主要介绍Python3调用阿里云人脸识别服务,参数等的获取参考阿里云人脸识别使用流程简介。

作者:俏巴


概述


前面分别给出了关于阿里云人脸识别Java调用示例参考阿里云人脸识别C#调用示例参考 。本文主要介绍Python3调用阿里云人脸识别服务,参数等的获取参考阿里云人脸识别使用流程简介


Code Sample


1、使用网络图片


#!/usr/bin/env python

coding=utf-8

import datetime
import hmac
import hashlib
import json
from urllib.parse import urlparse
import base64
import http.client

获取时间

def get_current_date():

date = datetime.datetime.strftime(datetime.datetime.utcnow(), <span class="hljs-string">"%a, %d %b %Y %H:%M:%S GMT"</span>)
<span class="hljs-keyword">return</span> date

计算MD5+BASE64

def getcode(bodyData):

temp = bodyData.encode(<span class="hljs-string">"utf-8"</span>)
md5 = hashlib.md5()
md5.update(temp)
md5str = md5.digest()  # <span class="hljs-number">16</span>位
b64str = base64.b64encode(md5str)
<span class="hljs-keyword">return</span> b64str

计算 HMAC-SHA1

def to_sha1_base64(stringToSign, secret):

hmacsha1 = hmac.new(secret.encode(), stringToSign.encode(), hashlib.sha1)
<span class="hljs-keyword">return</span> base64.b64encode(hmacsha1.digest())

初始参数设置

ak_id = ''
ak_secret = ''
datetime1 = get_current_date() # 获取时间

根据实际测试需要设置自己的图片URL

options = {

<span class="hljs-string">'url'</span>: <span class="hljs-string">'https://dtplus-cn-shanghai.data.aliyuncs.com/face/attribute'</span>,
<span class="hljs-string">'method'</span>: <span class="hljs-string">'POST'</span>,
<span class="hljs-string">'body'</span>: json.dumps({<span class="hljs-string">"type"</span>: <span class="hljs-string">"0"</span>, <span class="hljs-string">"image_url"</span>:<span class="hljs-string">"https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1553926699&di=3e4484731c8897c57e67b3f632801f9a&src=http://b-ssl.duitang.com/uploads/item/201603/28/20160328121906_ErzAB.jpeg"</span>}, separators=(<span class="hljs-string">','</span>, <span class="hljs-string">':'</span>)),
<span class="hljs-string">'headers'</span>: {
    <span class="hljs-string">'accept'</span>: <span class="hljs-string">'application/json'</span>,
    <span class="hljs-string">'content-type'</span>: <span class="hljs-string">'application/json'</span>,
    <span class="hljs-string">'date'</span>:  datetime1
}

}

body = '' # 请求body参数
if 'body' in options:

body = options[<span class="hljs-string">'body'</span>]

print(body)

bodymd5 = '' # 计算获取请求body的md5值
if not body == '':

bodymd5 = getcode(body)
bodymd5 = bodymd5.decode(encoding=<span class="hljs-string">'utf-8'</span>)

urlPath = urlparse(options['url'])
restUrl = urlPath[1]
path = urlPath[2]

拼接请求签名字符串

stringToSign = options['method'] + 'n' + options'headers' + 'n' + bodymd5 + 'n' + options'headers' + 'n' + options'headers' + 'n' + path
signature = to_sha1_base64(stringToSign, ak_secret)
signature = signature.decode(encoding='utf-8')
authHeader = 'Dataplus ' + ak_id + ':' + signature # 组合认证Authorization

请求Header

headers = {

# Request headers
<span class="hljs-string">'Content-Type'</span>: options[<span class="hljs-string">'headers'</span>][<span class="hljs-string">'content-type'</span>],
<span class="hljs-string">'Authorization'</span>: authHeader,
<span class="hljs-string">'Date'</span>: datetime1,
<span class="hljs-string">'Accept'</span>: options[<span class="hljs-string">'headers'</span>][<span class="hljs-string">'accept'</span>]

}

try:

# 设置http请求参数
conn = http.client.HTTPSConnection(restUrl)
conn.request(options[<span class="hljs-string">'method'</span>], path, body, headers)
response = conn.getresponse()
data = response.read()
print(<span class="hljs-string">"Result: "</span>, data)
conn.close()

except Exception as e:

print(<span class="hljs-string">"[Errno {0}] {1}"</span>.format(e.errno, e.strerror))</code></pre>

2、使用本地图片


#!/usr/bin/env python

coding=utf-8

import datetime
import hmac
import hashlib
import json
from urllib.parse import urlparse
import base64
import http.client

获取时间

def get_current_date():

date = datetime.datetime.strftime(datetime.datetime.utcnow(), <span class="hljs-string">"%a, %d %b %Y %H:%M:%S GMT"</span>)
<span class="hljs-keyword">return</span> date

计算MD5+BASE64

def getcode(bodyData):

temp = bodyData.encode(<span class="hljs-string">"utf-8"</span>)
md5 = hashlib.md5()
md5.update(temp)
md5str = md5.digest()  # <span class="hljs-number">16</span>位
b64str = base64.b64encode(md5str)
<span class="hljs-keyword">return</span> b64str

计算 HMAC-SHA1

def to_sha1_base64(stringToSign, secret):

hmacsha1 = hmac.new(secret.encode(), stringToSign.encode(), hashlib.sha1)
<span class="hljs-keyword">return</span> base64.b64encode(hmacsha1.digest())

初始参数设置

ak_id = ''
ak_secret = ''
datetime1 = get_current_date() # 获取时间

读取本地图片

filenamePath = "C:\Users\Administrator\Desktop\time.jpeg" # 测试图片存放在项目目录下
base64_data = ''
with open(filenamePath, "rb") as f:

base64_data = base64.b64encode(f.read())

options = {

<span class="hljs-string">'url'</span>: <span class="hljs-string">'https://dtplus-cn-shanghai.data.aliyuncs.com/face/attribute'</span>,
<span class="hljs-string">'method'</span>: <span class="hljs-string">'POST'</span>,
<span class="hljs-string">'body'</span>: json.dumps({<span class="hljs-string">"type"</span>: <span class="hljs-string">"1"</span>, <span class="hljs-string">"content"</span>: base64_data.decode()}, separators=(<span class="hljs-string">','</span>, <span class="hljs-string">':'</span>)),
<span class="hljs-string">'headers'</span>: {
    <span class="hljs-string">'accept'</span>: <span class="hljs-string">'application/json'</span>,
    <span class="hljs-string">'content-type'</span>: <span class="hljs-string">'application/json'</span>,
    <span class="hljs-string">'date'</span>:  datetime1
}

}

body = '' # 请求body参数
if 'body' in options:

body = options[<span class="hljs-string">'body'</span>]

bodymd5 = '' # 计算获取请求body的md5值
if not body == '':

bodymd5 = getcode(body)
bodymd5 = bodymd5.decode(encoding=<span class="hljs-string">'utf-8'</span>)

urlPath = urlparse(options['url'])
restUrl = urlPath[1]
path = urlPath[2]

拼接请求签名字符串

stringToSign = options['method'] + 'n' + options'headers' + 'n' + bodymd5 + 'n' + options'headers' + 'n' + options'headers' + 'n' + path
signature = to_sha1_base64(stringToSign, ak_secret)
signature = signature.decode(encoding='utf-8')
authHeader = 'Dataplus ' + ak_id + ':' + signature # 组合认证Authorization

请求Header

headers = {

# Request headers
<span class="hljs-string">'Content-Type'</span>: options[<span class="hljs-string">'headers'</span>][<span class="hljs-string">'content-type'</span>],
<span class="hljs-string">'Authorization'</span>: authHeader,
<span class="hljs-string">'Date'</span>: datetime1,
<span class="hljs-string">'Accept'</span>: options[<span class="hljs-string">'headers'</span>][<span class="hljs-string">'accept'</span>]

}

try:

# 设置http请求参数
conn = http.client.HTTPSConnection(restUrl)
conn.request(options[<span class="hljs-string">'method'</span>], path, body, headers)

response = conn.getresponse()
data = response.read()
print(<span class="hljs-string">"Result: "</span>, data)
conn.close()

except Exception as e:

print(<span class="hljs-string">"[Errno {0}] {1}"</span>.format(e.errno, e.strerror))</code></pre>

测试结果

Result:  b'{"face_num":1,"face_rect":[130,15,215,310],"face_prob":[1.0],"pose":[-39.87171173095703,3.1629905700683594,13.316142082214355],"landmark_num":105,"landmark":[149.30978393554688,96.07989501953125,182.51048278808594,103.61891174316406,168.19293212890625,92.86424255371094,163.5982208251953,106.67083740234375,155.65652465820312,94.533203125,161.86233520507812,92.48291015625,174.61239624023438,94.07614135742188,179.53085327148438,97.82328796386719,152.27731323242188,101.85122680664062,157.28382873535156,105.69109344482422,170.13148498535156,106.65303039550781,176.65440368652344,106.27960205078125,208.31942749023438,89.45866394042969,251.87301635742188,93.79106140136719,230.0853271484375,81.89714813232422,230.51527404785156,89.68502044677734,216.79515075683594,89.6149673461914,222.552490234375,84.50181579589844,238.20196533203125,84.00875854492188,245.5213165283203,88.17695617675781,215.89784240722656,89.83271789550781,223.32289123535156,91.33856201171875,237.9641876220703,88.7492446899414,245.1739501953125,90.21171569824219,142.1407928466797,125.49142456054688,164.00509643554688,128.34051513671875,145.10891723632812,125.63172912597656,147.94424438476562,126.44818115234375,150.6500244140625,126.81088256835938,153.4158935546875,126.65888977050781,156.25343322753906,126.86927795410156,159.156494140625,126.25942993164062,162.1279296875,126.26718139648438,145.39768981933594,123.09931945800781,148.59031677246094,120.63629150390625,151.33578491210938,117.68092346191406,154.80978393554688,115.87629699707031,158.06561279296875,117.82699584960938,160.29257202148438,121.1617202758789,162.145263671875,124.75296020507812,200.3869171142578,125.40289306640625,231.9613494873047,124.36839294433594,202.9525146484375,120.96773529052734,206.4003143310547,117.19731903076172,210.5859375,114.27775573730469,215.563232421875,113.27265930175781,220.54940795898438,114.28883361816406,224.9191131591797,116.93064880371094,228.459716796875,120.62786865234375,204.07652282714844,127.05133056640625,208.1422119140625,127.06246948242188,212.20623779296875,126.94207763671875,216.26516723632812,127.16531372070312,220.33071899414062,127.17938232421875,224.38912963867188,126.94290161132812,228.40740966796875,126.33187866210938,180.68057250976562,124.24948120117188,143.97146606445312,165.38916015625,162.32351684570312,144.94175720214844,134.83917236328125,195.49285888671875,122.00972747802734,167.71177673339844,163.79940795898438,201.26856994628906,133.96788024902344,245.5172119140625,168.45970153808594,249.88409423828125,137.96688842773438,246.32608032226562,162.34890747070312,248.4250030517578,146.12969970703125,236.7351531982422,142.00628662109375,233.75799560546875,153.06297302246094,233.48440551757812,139.43922424316406,240.54153442382812,161.5366973876953,240.76181030273438,137.25955200195312,243.36386108398438,139.29791259765625,236.613037109375,157.93588256835938,236.3226776123047,164.93807983398438,245.3672637939453,145.94772338867188,265.2122802734375,136.9383544921875,257.0703430175781,157.47044372558594,258.2634582519531,135.5330810546875,251.39419555664062,141.1232452392578,261.4836120605469,152.50865173339844,263.0754089355469,162.8560028076172,253.93109130859375,144.8207244873047,237.47555541992188,144.15426635742188,260.6490173339844,143.27313232421875,244.08506774902344,141.33230590820312,252.95635986328125,154.9131317138672,240.41152954101562,153.11502075195312,254.006591796875,141.71063232421875,246.61111450195312,141.28138732910156,248.74069213867188,142.75051879882812,240.49295043945312,141.84674072265625,257.1341552734375,150.30157470703125,237.34103393554688,148.99655151367188,257.8171691894531,159.0953826904297,243.94061279296875,156.98509216308594,250.0796356201172,155.39328002929688,125.05921936035156,372.2781066894531,161.79226684570312,143.71853637695312,331.37054443359375,129.91876220703125,224.91555786132812,295.54632568359375,291.6700744628906,139.50717163085938,173.88755798339844,340.72607421875,227.22573852539062,133.99127197265625,277.83892822265625,219.85977172851562,330.39678955078125],"iris":[160.3740234375,119.46086120605469,7.996552467346191,218.89495849609375,120.74580383300781,7.996552467346191],"gender":[0],"age":[24],"expression":[0],"glass":[0],"dense_fea_len":1024,"dense_fea":[-0.033544983714818954,0.021493861451745033,-0.03707369789481163,0.016898849979043007,-0.004632312338799238,0.037434328347444534,-0.01807882823050022,-0.010931204073131084,-0.028910614550113678,0.043657224625349045,-0.026060305535793304,-0.003893705317750573,0.03442023694515228,-0.010351949371397495,-7.559417863376439E-4,-2.679374301806092E-4,0.0024537802673876286,0.0029371269047260284,0.005171386990696192,0.0018515388946980238,0.009399348869919777,0.039642252027988434,-0.011193244718015194,-0.05458361655473709,-0.01632157526910305,0.02716182917356491,0.021897418424487114,0.05615152046084404,0.044466160237789154,0.003527723951265216,0.01513021532446146,-0.014997648075222969,0.011155657470226288,-0.028343327343463898,0.0023595313541591167,-0.004931764677166939,-0.02577102556824684,-0.005432958249002695,0.009341402910649776,0.020895158872008324,-0.02757137641310692,0.008275407366454601,0.03265943378210068,-0.005536186974495649,0.003853890812024474,-0.012449859641492367,0.0033247298561036587,0.008547043427824974,0.029377620667219162,-0.03386402502655983,0.009668853133916855,0.055355362594127655,-0.013663968071341515,-0.012665587477385998,0.01619097776710987,0.025824297219514847,0.028619715943932533,0.005516762379556894,-0.017348909750580788,0.024269938468933105,-0.04256538674235344,-0.031264062970876694,-0.030936332419514656,-0.02573447674512863,0.0011568147456273437,-0.020667744800448418,-0.010579986497759819,-0.04899405315518379,0.053391922265291214,-0.010899713262915611,0.03673243522644043,0.026941977441310883,0.046722885221242905,0.0024341479875147343,-0.0033010130282491446,-0.029104841873049736,0.03276406601071358,-0.020281152799725533,-0.034783195704221725,-0.053696971386671066,0.01717855967581272,-0.039629194885492325,-0.027075594291090965,-0.09283123910427094,-0.036874059587717056,0.03910595551133156,-0.0094133410602808,-0.04478362575173378,-0.032480135560035706,0.035419099032878876,-0.015403763391077518,0.03671712800860405,0.03821445629000664,0.015638798475265503,0.008627666160464287,-0.026869114488363266,-0.041939057409763336,0.01891917549073696,-0.009780273772776127,0.028666295111179352,-4.2076854151673615E-4,-0.05119339004158974,-0.030526787042617798,0.00613499665632844,-0.030404191464185715,0.01631208509206772,0.03350212052464485,-0.05890056490898132,-0.015175780281424522,-0.010676849633455276,-0.025685807690024376,0.07041462510824203,-0.003197013633325696,-0.03770378604531288,-0.013089654967188835,-0.03985678777098656,0.04535342752933502,0.06159883737564087,-0.020950837060809135,-0.0037938726600259542,0.0783001184463501,-0.020365936681628227,0.06724532693624496,0.029376715421676636,-0.005071823485195637,-0.023196905851364136,-0.019188275560736656,-0.010816864669322968,-0.018320010975003242,-0.0057846372947096825,0.025134392082691193,0.06687908619642258,-0.0069528063759207726,0.027837591245770454,-0.019966712221503258,-0.011638154275715351,-0.009847540408372879,-0.017792250961065292,0.02056516334414482,0.03443070873618126,-0.00102553132455796,0.0369531475007534,-0.01211757306009531,0.013819603249430656,0.04259513318538666,-3.0390251777134836E-4,-0.020683832466602325,-0.0407491996884346,0.014929411932826042,0.02236754819750786,-0.0015721236122772098,-0.0013863679487258196,0.05189500376582146,0.020072070881724358,0.034894175827503204,-0.05144902691245079,-0.02113325335085392,-0.007614230737090111,-0.020545851439237595,0.026386704295873642,0.01829005777835846,0.01636347733438015,0.01079919096082449,0.02430901490151882,-0.025638028979301453,0.05542585626244545,-0.03685402125120163,-0.050555262714624405,0.006613851059228182,-0.03898997977375984,-0.02968793548643589,0.0019689679611474276,0.06069785729050636,3.9217210724018514E-4,0.011618235148489475,0.03445177897810936,0.006166849751025438,-0.05174801126122475,0.03234916552901268,-0.01037298608571291,-0.011899982579052448,-0.013889885507524014,0.06916779279708862,-0.0014020493254065514,-0.041023802012205124,-0.002121157245710492,-0.00936880148947239,-0.019968105480074883,-0.0037011061795055866,0.026557350531220436,-0.02304121106863022,-0.007167809177190065,-0.03815170004963875,0.03216726705431938,0.01657652109861374,0.021111054345965385,-0.019831033423542976,-0.01958567090332508,0.062146835029125214,-0.04413547366857529,0.03008476085960865,3.730190801434219E-4,0.035415273159742355,-0.004021772649139166,0.007319919764995575,0.00773631501942873,-0.02745644561946392,0.04413884878158569,0.006686453241854906,-0.023236960172653198,0.03559807687997818,0.022022876888513565,0.010444101877510548,-0.03281478211283684,-0.009790154173970222,-0.0034506823867559433,0.04206223785877228,-0.011488359421491623,0.03335973247885704,0.002371730050072074,-0.022155553102493286,-0.03751770406961441,0.06240161508321762,0.04891081154346466,6.36521668639034E-4,-0.0014370979042723775,-0.010593313723802567,0.005371685605496168,0.03137367218732834,-0.06283304840326309,-0.02380504086613655,-0.10086460411548615,-0.014823103323578835,0.027359476312994957,0.015014763921499252,-0.00686298543587327,-0.024750297889113426,-0.02486703358590603,-0.001509835827164352,-0.003376282984390855,0.0077372449450194836,-0.028540167957544327,-0.0372912771999836,0.008422398939728737,-0.022614680230617523,-0.021024562418460846,-0.007846660912036896,0.007127932272851467,-0.0026057132054120302,0.05224660411477089,0.00827732216566801,-0.0014453500043600798,0.02258734032511711,0.02375117689371109,0.021893586963415146,0.038206860423088074,-0.04814612492918968,0.03930506482720375,-0.05548982694745064,0.048304036259651184,0.03170348331332207,0.023461252450942993,0.03835047036409378,-0.0017732863780111074,0.044239576905965805,-0.011653449386358261,-0.03149421885609627,-0.018219562247395515,0.011598454788327217,0.013570932671427727,-0.017634306102991104,0.041144099086523056,0.008379482664167881,0.01871892437338829,0.00873657502233982,-0.005992984399199486,-0.04292573407292366,0.021047407761216164,-0.0014965087175369263,0.011354560032486916,-0.04932072386145592,0.012459644116461277,-0.07847173511981964,-0.017345819622278214,-0.033171892166137695,0.03632417693734169,-0.002100616227835417,0.024262992665171623,-0.08097171783447266,0.021562326699495316,-0.040275588631629944,-0.021548932418227196,-0.05775504931807518,-0.014151956886053085,-0.01796954870223999,0.015180998481810093,6.094740820117295E-4,-0.00448472099378705,0.013728498481214046,0.024575021117925644,-0.07153914123773575,-0.023969892412424088,0.058911364525556564,0.017156409099698067,-0.030992789193987846,-0.0363016352057457,-0.01770148240029812,-0.019964706152677536,-0.003151643555611372,-0.02853550761938095,0.024293694645166397,-0.001021342002786696,0.020227162167429924,0.03960956633090973,-0.01930554024875164,0.024525722488760948,-0.05382419750094414,-0.04809984564781189,0.002956176409497857,0.03601662069559097,0.011174644343554974,0.012468627654016018,-0.05947614088654518,-0.01814759150147438,0.027704846113920212,-0.020755155012011528,-0.01915748603641987,-0.025520028546452522,0.003194746095687151,0.026282981038093567,-0.014577885158360004,0.0191080030053854,0.05513698607683182,0.009248529560863972,-0.009870640933513641,-0.017714936286211014,-0.027597011998295784,0.021671606227755547,-0.030827373266220093,0.013503946363925934,0.018642766401171684,0.04137825220823288,0.00536402827128768,0.017603741958737373,0.016420209780335426,-0.025376364588737488,0.007170502562075853,0.05540626868605614,0.020135877653956413,-0.011834324337542057,0.03750704601407051,0.017378857359290123,0.005103968549519777,-0.0066647338680922985,0.02918531745672226,0.006007883697748184,-0.03187212347984314,-0.014260184951126575,0.01174403540790081,-0.010403330437839031,-0.01248595118522644,-8.213016553781927E-4,0.012893111445009708,-0.0025794068351387978,-0.06897164136171341,-0.06352511048316956,-0.0018075885018333793,-0.0024971605744212866,-0.04636228084564209,-0.030435357242822647,-0.0665692389011383,0.040477294474840164,7.532616727985442E-4,0.033534929156303406,0.023689141497015953,-0.04147093743085861,-0.008379709906876087,0.016404904425144196,-0.0053562745451927185,0.010229774750769138,-0.03663106635212898,-0.013892446644604206,0.004859228152781725,-0.0032811209093779325,0.017878368496894836,-0.04390283301472664,0.033951565623283386,-0.0036209961399435997,0.03570288419723511,0.008324076421558857,-0.029430262744426727,0.02899334952235222,-0.00406453525647521,-0.005250243004411459,0.01662282459437847,-0.021512378007173538,-0.03320090100169182,0.04414794594049454,0.014157893136143684,-0.021999763324856758,0.025695480406284332,-0.004864169284701347,0.07958456873893738,-0.004217679146677256,6.765115540474653E-4,-0.017559727653861046,0.017222857102751732,0.05102553963661194,0.007386807817965746,-0.015616599470376968,-0.06067207455635071,0.014622796326875687,0.057662274688482285,0.04162175580859184,-0.03824446350336075,-0.0159388966858387,-0.0365079864859581,0.019202494993805885,-0.017192114144563675,-0.007192360702902079,0.03232830762863159,-0.028253009542822838,-0.008280831389129162,0.061438582837581635,0.037586819380521774,0.026670342311263084,0.01571675017476082,-0.04026151821017265,-0.003739861538633704,-0.019044579938054085,-0.023643257096409798,-0.10347584635019302,0.003982686437666416,-0.03047959692776203,-0.010796701535582542,-0.025425853207707405,-0.005101361311972141,-0.023258239030838013,0.02148924581706524,-0.019400080665946007,-0.05414227396249771,0.028083283454179764,0.00785425491631031,-0.07360988110303879,0.03226020187139511,-0.046259887516498566,0.008721699938178062,-0.05952988937497139,0.06667811423540115,-0.003974427469074726,-0.01784663088619709,-0.10948371142148972,-0.021188754588365555,-0.015350074507296085,-0.012835836969316006,0.05758494883775711,-0.04072980582714081,-0.012067103758454323,-0.010894288308918476,-0.04270276799798012,0.012727533467113972,0.004685741383582354,0.07602471858263016,0.0016961380606517196,-0.013515980914235115,-0.005692157428711653,0.01636682078242302,0.033978383988142014,-0.01608719304203987,0.04595861956477165,-0.04989415779709816,-0.0016735560493543744,0.06802333146333694,0.011799194850027561,-0.0071228425949811935,0.0031758896075189114,0.021710122004151344,0.004432468209415674,-0.02393813617527485,-0.04097552224993706,0.022954575717449188,-0.008526893332600594,0.010788229294121265,-0.0402936115860939,-0.012991044670343399,-0.008680054917931557,0.029733991250395775,-0.03792283311486244,0.00892985425889492,0.03446977585554123,0.027031630277633667,-0.04755193367600441,-0.0152456508949399,-0.0019067671382799745,-0.024405214935541153,-0.08887625485658646,-0.032943084836006165,-0.02481684461236,-0.05095075070858002,-0.007637105416506529,0.01733108051121235,0.016512000933289528,-0.004072108305990696,-0.04315131530165672,-0.01812290959060192,-0.027048204094171524,-0.005746850743889809,0.0021113785915076733,0.042122483253479004,-0.06742586195468903,0.030395301058888435,0.016080845147371292,-0.03441660851240158,-0.018529105931520462,-0.025479251518845558,0.01775159128010273,0.03962792456150055,-0.02330849878489971,0.0056010885164141655,-0.00927573349326849,0.06180152669548988,0.02625194750726223,-0.04029328376054764,-0.04594509303569794,0.037539586424827576,-0.021860897541046143,0.024531766772270203,0.042646780610084534,0.030220529064536095,-5.981938447803259E-4,0.0025560720823705196,0.042995840311050415,-0.05480080842971802,-0.016773227602243423,0.01388543751090765,-0.03556016460061073,0.0014066981384530663,0.016067489981651306,-0.016334690153598785,0.025355525314807892,9.978138841688633E-4,-0.022121435031294823,0.005747097544372082,0.033152155578136444,0.05124209076166153,-0.007371564395725727,-0.012459740042686462,0.006508891470730305,-0.04934525117278099,0.0017359935445711017,0.02674233727157116,0.005970890633761883,0.03680212423205376,0.035376809537410736,0.0073082707822322845,0.03931774944067001,-0.03320200368762016,0.012281160801649094,-0.05499810352921486,-0.0023433228489011526,-0.030078772455453873,-0.059042930603027344,-0.008790498599410057,0.022272031754255295,-0.009516247548162937,0.030941862612962723,-0.022691234946250916,-0.04176153242588043,0.007353128399699926,-0.0067167808301746845,-0.010934265330433846,3.4936543670482934E-4,0.02047651633620262,-0.004770074505358934,-0.006692566908895969,0.015546443872153759,-0.02269819937646389,-0.010414686985313892,-0.010459082201123238,-0.026267148554325104,0.011619885452091694,-0.005642102099955082,-0.01220529992133379,0.0013130054576322436,0.020098932087421417,0.0533863864839077,-0.0023439498618245125,0.0213633943349123,0.00229673832654953,-0.03349890932440758,0.06614398956298828,0.00291360798291862,-0.013645117171108723,0.01823827438056469,-0.05018996074795723,-0.030836354941129684,4.2484953883104026E-4,0.03303535282611847,0.0034003695473074913,-0.017994554713368416,-1.5276859630830586E-4,0.046897921711206436,0.013182004913687706,0.014990079216659069,0.03087581694126129,-0.019311949610710144,0.021460091695189476,0.02432500384747982,-0.013448789715766907,-0.004397288896143436,-0.030860252678394318,0.0332343764603138,-0.027299251407384872,-0.07084154337644577,0.025473294779658318,0.013865427114069462,-0.014629686251282692,0.06193035840988159,0.01905219629406929,-0.0531296543776989,0.06274012476205826,-0.002830007579177618,0.014757221564650536,-0.012569400481879711,0.03873192518949509,-0.006091062445193529,-0.012287278659641743,0.04827189818024635,0.04154926910996437,0.05130639299750328,-0.01600804552435875,-0.031093548983335495,0.05369553714990616,-0.03250192850828171,0.022457851096987724,2.4835573276504874E-4,0.06375394016504288,-0.01360691711306572,0.01199597679078579,-0.0047557479701936245,0.0061682057566940784,-0.008240191265940666,-0.01841135509312153,0.055363304913043976,0.01691262237727642,0.027622926980257034,-0.011763385497033596,0.019077105447649956,-0.025141356512904167,-0.002882453380152583,0.04505174234509468,0.017055045813322067,-0.009449582546949387,0.014001142233610153,0.017438173294067383,0.005731815472245216,0.020053783431649208,0.010066111572086811,0.010053855367004871,0.026541100814938545,0.008128933608531952,0.022918034344911575,0.044660139828920364,-0.08515964448451996,-0.05061518773436546,-0.011806574650108814,0.012573091313242912,0.05411598086357117,-0.018861303105950356,-0.01895800046622753,0.03294042497873306,0.024142300710082054,-0.0029092682525515556,-0.011298838071525097,0.07396780699491501,-0.013887626118957996,-3.8417355972342193E-4,0.04070916026830673,-0.004510439466685057,-0.013786009512841702,-0.014512712135910988,-0.0035393191501498222,0.01514570601284504,-0.008323351852595806,0.009951088577508926,0.024150289595127106,0.008385922759771347,-0.007945799268782139,0.011301597580313683,-0.008653339929878712,-0.030004439875483513,-0.002770420629531145,0.04806428402662277,-0.016817636787891388,-0.00960061140358448,0.020596085116267204,-0.06508870422840118,-0.03241802006959915,-0.05302714928984642,-0.04330020397901535,-0.008469433523714542,0.036508917808532715,-0.03326889127492905,0.010157576762139797,-7.900867494754493E-4,0.004914761520922184,0.04957052692770958,0.022239122539758682,-0.03138289600610733,0.025244830176234245,0.031145401298999786,-0.013343085534870625,-0.009798457846045494,0.013804704882204533,0.025304527953267097,0.02063991315662861,0.02258939854800701,0.035072725266218185,4.423113205120899E-5,0.0015321389073505998,0.058520857244729996,-0.013973671942949295,0.03938750550150871,-0.08152689039707184,0.024855397641658783,-0.03777721896767616,-0.0504840649664402,-0.0035453159362077713,0.026916226372122765,0.013781788758933544,-0.010182080790400505,0.02051805518567562,-0.03534212335944176,0.004853083752095699,0.020619511604309082,0.023286908864974976,-0.04564844071865082,-0.01683248206973076,-8.406268898397684E-4,0.019705191254615784,-0.016735289245843887,-0.02625718154013157,-0.007182382978498936,-0.05997702479362488,-0.01739036850631237,7.350515224970877E-4,0.007082967087626457,-0.033269017934799194,0.025722699239850044,0.022219985723495483,0.004861766938120127,-0.04882443696260452,0.004752642009407282,-0.020441053435206413,-0.022076714783906937,0.016478151082992554,0.024197077378630638,0.004168791230767965,0.03495752811431885,-0.0780455693602562,0.017255432903766632,0.0030120383016765118,-0.03891477361321449,0.01259182021021843,-0.041579701006412506,-0.04140768200159073,0.006905585993081331,0.02103169448673725,-0.07068132609128952,0.057088397443294525,-0.034126702696084976,0.03555086627602577,0.029360854998230934,0.03848566114902496,0.04484724998474121,0.04125732555985451,0.02795700915157795,0.0062053147703409195,2.291528944624588E-4,0.05159357935190201,-0.013082143850624561,0.0028986064717173576,-0.056611742824316025,-0.0034548062831163406,-3.527631633915007E-4,-0.04315973073244095,0.057486336678266525,-0.02801692858338356,-0.021808302029967308,0.022041629999876022,0.00971227791160345,0.03569652885198593,-0.016904158517718315,0.004419777076691389,-0.0986197292804718,-0.02377351000905037,0.005422938149422407,0.0014849996659904718,-0.007607951294630766,-0.012286399491131306,-0.025936532765626907,-0.026625942438840866,-0.02926095575094223,0.013254367746412754,0.0387970469892025,0.016667887568473816,-0.04526982456445694,-0.031068678945302963,-0.013017088174819946,-0.07388396561145782,-0.011012987233698368,-0.010769134387373924,-0.05212036520242691,0.03764986991882324,-0.0014839631039649248,0.015600795857608318,0.018413757905364037,-0.01199017558246851,-0.023572105914354324,0.04740019515156746,0.05999673530459404,0.037471674382686615,0.020128125324845314,0.06317227333784103,0.04533494636416435,0.038128722459077835,-0.013746308162808418,-0.0157545804977417,-0.028774555772542953,-0.02570362761616707,0.027183933183550835,0.03259919583797455,0.04328028857707977,0.019666282460093498,0.03651181980967522,0.027378978207707405,0.018380997702479362,0.02833513170480728,0.023912467062473297,-0.024632351472973824,-0.02488786168396473,0.04030861333012581,0.018362080678343773,0.03208238258957863,0.019736066460609436,-0.015068740583956242,-0.05074608325958252,-0.03082553669810295,-0.011131130158901215,0.06482495367527008,0.04227456822991371,-0.03324728459119797,-0.019914500415325165,0.02467808872461319,0.03450756520032883,-0.0291382297873497,-0.01590769551694393,0.0028949673287570477,-0.01834801770746708,-0.008014529012143612,-0.0087068947032094,-0.05256563425064087,0.023060956969857216,0.007953310385346413,0.03552033007144928,-0.003772355616092682,0.0023747989907860756,0.017638422548770905,0.02081998810172081,0.009308652952313423,0.03187587857246399,-0.004461818374693394,0.012328257784247398,-0.005877261515706778,-0.001048574922606349,-0.006252992898225784,0.003705517388880253,-0.08932404220104218,0.02185247838497162,-0.020857905969023705,-0.026783745735883713,0.004192478489130735,0.0529840886592865,-0.047044817358255386,0.022931121289730072,-0.002252612030133605,0.022251347079873085,-0.0029724210035055876,0.046577177941799164,0.0023998692631721497,0.028210140764713287,0.031832266598939896,0.037367332726716995,0.01196916401386261,-0.04100754112005234,-0.03978054225444794,-0.0332443043589592,-0.008746076375246048,0.01914166286587715,0.04082348197698593,0.004259354434907436,0.008485909551382065,-0.001767807058058679,0.004104151390492916,-0.015923038125038147,-0.06045778468251228,0.04901101067662239,-0.014905191957950592,-0.021929504349827766,-0.016429582610726357,-0.024615898728370667,0.0019531631842255592,0.0066946325823664665,0.030084002763032913,0.018569380044937134,0.03863547369837761,0.05148209631443024,0.02358395978808403,-0.014249132014811039,-0.029580824077129364,-0.002585944253951311,-0.027951108291745186,-0.01452549546957016,0.031230589374899864,-0.03227942809462547,0.04939102381467819,0.053762905299663544,-0.005102705676108599,-0.03685982525348663,0.03361324965953827,0.03139606863260269,0.05398290604352951,-0.021641284227371216,-0.06120738759636879,-0.04619584605097771,-0.001976406667381525,-0.006791504565626383,-0.023955103009939194,0.018071040511131287,-0.04756784439086914,-0.021874360740184784,-0.04103492572903633,0.01071634516119957,-0.023836305364966393,-0.008193139918148518,0.002420480828732252,0.03241882845759392,-0.03592820465564728,0.0770857110619545,-0.007454876787960529,-0.03822220116853714,0.011972165666520596,-0.014918367378413677,-0.016599951311945915,0.006600363180041313,-0.01322399452328682,-0.013423006050288677,-0.05494241043925285,-0.023906756192445755,-0.10043513029813766,0.04646169766783714,0.015085027553141117,0.022765859961509705,-0.007441655732691288,0.008860446512699127,0.012846022844314575,0.03943183273077011,-0.015465358272194862,0.0030562696047127247,-0.05353390425443649,0.011624429374933243,-0.005371786653995514,0.016666987910866737,0.01854395493865013,0.0465974397957325,0.06647896766662598,0.02551991678774357,-0.04375441372394562,-0.005851077381521463,-0.012031655758619308,0.028079811483621597,-0.04218191280961037,-0.027401473373174667,0.012074055150151253,0.03860609605908394,-0.007465906906872988,0.026534689590334892,-0.0030618614982813597,0.061922576278448105,-0.039572760462760925,0.008632085286080837,0.0414813868701458,0.026602914556860924,0.007838152348995209,0.05065729469060898,-0.0033313874155282974,-0.03426007181406021,-0.004171727690845728,-0.007768699433654547,0.021342195570468903,-0.01188813615590334,0.05989415571093559,0.034085776656866074,-0.041400376707315445,-0.009571866132318974,-0.026281563565135002,-0.023030363023281097,-0.008558910340070724,0.007508947979658842,-0.07245126366615295,-0.08330035209655762,0.0384298600256443,0.017579257488250732,0.020582331344485283,-0.07105600833892822,-0.044998325407505035,-0.030365269631147385,0.028823740780353546,-0.006451532244682312,0.047917407006025314,0.02943483181297779,-0.024125680327415466,0.011835487559437752,-0.017350299283862114],"errno":0,"request_id":"8338f63b-07fe-455f-9680-d468fcf76130"}'
相关文章
|
2月前
|
数据挖掘 Python
Python示例,展示如何找到最近一次死叉之后尚未形成金叉的位置
【10月更文挑战第7天】金融分析中,“死叉”指短期移动平均线(如MA5)跌破长期移动平均线(如MA10),而“金叉”则相反。本文提供Python代码示例,用于找出最近一次死叉后未形成金叉的位置,涵盖移动平均线计算、交叉点判断及结果输出等步骤,适合金融数据分析。
44 4
|
1天前
|
数据可视化 Python
以下是一些常用的图表类型及其Python代码示例,使用Matplotlib和Seaborn库。
通过这些思维导图和分析说明表,您可以更直观地理解和选择适合的数据可视化图表类型,帮助更有效地展示和分析数据。
25 8
|
9天前
|
API Python
【Azure Developer】分享一段Python代码调用Graph API创建用户的示例
分享一段Python代码调用Graph API创建用户的示例
29 11
|
12天前
|
网络安全 Python
Python网络编程小示例:生成CIDR表示的IP地址范围
本文介绍了如何使用Python生成CIDR表示的IP地址范围,通过解析CIDR字符串,将其转换为二进制形式,应用子网掩码,最终生成该CIDR块内所有可用的IP地址列表。示例代码利用了Python的`ipaddress`模块,展示了从指定CIDR表达式中提取所有IP地址的过程。
29 6
|
1月前
|
数据挖掘 Python
Python示例,展示如何找到最近一次死叉之后尚未形成金叉的位置
金融分析中,“死叉”指短期移动平均线(如MA5)跌破长期移动平均线(如MA10),而“金叉”则相反。本文提供Python代码示例,用于找出最近一次死叉后未形成金叉的位置,涵盖移动平均线计算、交叉点判断及结果输出等步骤,适合金融数据分析。
22 1
|
2月前
|
Linux Android开发 开发者
【Python】GUI:Kivy库环境安装与示例
这篇文章介绍了 Kivy 库的安装与使用示例。Kivy 是一个开源的 Python 库,支持多平台开发,适用于多点触控应用。文章详细说明了 Kivy 的主要特点、环境安装方法,并提供了两个示例:一个简单的 Hello World 应用和一个 BMI 计算器界面。
72 0
|
2月前
|
PyTorch 测试技术 算法框架/工具
Python中Thop库的常见用法和代码示例
肆十二在B站分享了关于THOP(Torch-OpCounter)的实战教学视频。THOP是一个用于计算PyTorch模型操作数和计算量的工具,帮助开发者评估模型复杂度和性能。本文介绍了THOP的安装、使用方法及基本用例,包括如何计算模型的FLOPs和参数量。
129 0
|
7月前
|
弹性计算 Java PHP
新手用户注册阿里云账号、实名认证、购买云服务器图文教程参考
对于初次购买阿里云产品的用户来说,第一步要做的是注册账号并完成实名认证,然后才是购买阿里云服务器或者其他云产品,本文为大家以图文形式展示一下新手用户从注册阿里云账号、实名认证到购买云服务器完整详细教程,以供参考。
新手用户注册阿里云账号、实名认证、购买云服务器图文教程参考
|
6月前
|
文字识别 算法 API
视觉智能开放平台产品使用合集之uniapp框架如何使用阿里云金融级人脸识别
视觉智能开放平台是指提供一系列基于视觉识别技术的API和服务的平台,这些服务通常包括图像识别、人脸识别、物体检测、文字识别、场景理解等。企业或开发者可以通过调用这些API,快速将视觉智能功能集成到自己的应用或服务中,而无需从零开始研发相关算法和技术。以下是一些常见的视觉智能开放平台产品及其应用场景的概览。
146 0