FaceAPI | Vector | Python | Euclidean Distance

import numpy as np

a = np.array([-0.0978008285164833, 0.17277762293815613, 0.056362003087997437, -0.08628915995359421, -0.08974268287420273, -0.07283758372068405, -0.08500419557094574, -0.10919857025146484, 0.20357529819011688, -0.19262145459651947, 0.18615193665027618, -0.04997587576508522, -0.2535887062549591, 0.0982096791267395, -0.08577050268650055, 0.15965388715267181, -0.24733038246631622, -0.15556922554969788, -0.03707346320152283, -0.0831558033823967, 0.10781767964363098, 0.04719191789627075, 0.0051578921265900135, 0.1150335967540741, -0.1961008608341217, -0.25725069642066956, -0.08743210136890411, -0.13064777851104736, -0.13976092636585236, -0.06875182688236237, 0.029632266610860825, 0.015391542576253414, -0.14720284938812256, 0.02745007537305355, -0.009600984863936901, 0.0844072625041008, -0.07003391534090042, -0.08734413236379623, 0.21110869944095612, 0.010128924623131752, -0.20768803358078003, 0.010449260473251343, 0.12197146564722061, 0.27067604660987854, 0.30735692381858826, -0.04541483148932457, 0.01009781751781702, -0.06621864438056946, 0.21537147462368011, -0.3909534215927124, 0.02874971181154251, 0.16048386693000793, 0.14277976751327515, 0.10656701028347015, 0.13954514265060425, -0.12952326238155365, 0.018705938011407852, 0.15346050262451172, -0.17874103784561157, 0.042955804616212845, 0.07729315012693405, -0.08199456334114075, 0.01592961698770523, -0.02424430660903454, 0.2805277705192566, 0.12043821811676025, -0.1810365468263626, -0.11940019577741623, 0.17374451458454132, -0.21009263396263123, -0.1237611323595047, 0.1489717811346054, -0.10747253149747849, -0.2425784170627594, -0.2660064399242401, 0.02510291524231434, 0.3581582009792328, 0.14937175810337067, -0.06876514852046967, 0.13028328120708466, -0.10961514711380005, -0.03594299405813217, -0.07662726193666458, 0.07985857874155045, -0.03030017390847206, 0.0021384060382843018, -0.12068287283182144, 0.05160510540008545, 0.2870980501174927, -0.07078172266483307, -0.02265443466603756, 0.32098183035850525, -0.024571502581238747, -0.03944770246744156, 0.03265972062945366, 0.07932614535093307, -0.15256479382514954, -0.06040599197149277, -0.14578461647033691, -0.026942705735564232, -0.001383417285978794, -0.08084818720817566, -0.10157545655965805, 0.06141592562198639, -0.25328999757766724, 0.13471435010433197, -0.12574799358844757, -0.04213268309831619, -0.114738330245018, -0.06955418735742569, -0.13990789651870728, 0.050968777388334274, 0.19400043785572052, -0.30263596773147583, 0.14067962765693665, 0.09058388322591782, 0.014685072004795074, 0.15229061245918274, 0.04835320636630058, -0.005952262319624424, 0.006512562744319439, -0.08180762082338333, -0.16283583641052246, -0.11373937129974365, 0.07142741978168488, -0.0027910443022847176, 0.047880832105875015, 0.034143660217523575],dtype=np.float64)

b = np.array([-0.0809471383690834, 0.12918394804000854, 0.021979952231049538, -0.037625133991241455, -0.11942397058010101, -0.025803217664361, -0.034735169261693954, -0.039634790271520615, 0.19187107682228088, -0.11901162564754486, 0.16131635010242462, -0.05101930722594261, -0.21951737999916077, 0.016566717997193336, 0.03845496103167534, 0.12396323680877686, -0.12790805101394653, -0.21658942103385925, -0.038682639598846436, -0.0433906614780426, 0.03429756686091423, -0.017365602776408195, -0.017810897901654243, 0.09894625097513199, -0.1905359923839569, -0.32244086265563965, -0.07410849630832672, -0.07001743465662003, -0.10909491032361984, -0.04879583418369293, -0.033347561955451965, 0.07183143496513367, -0.1835096925497055, -0.05300050228834152, 0.062002696096897125, 0.05918782949447632, 0.0072794039733707905, -0.024429820477962494, 0.19694215059280396, 0.012447627261281013, -0.211065411567688, -0.0204185638576746, 0.1242252066731453, 0.26681211590766907, 0.1639072597026825, 0.03610378876328468, -0.014631025493144989, 0.01775694638490677, 0.16406752169132233, -0.2681475877761841, -0.038796715438365936, 0.16629718244075775, 0.11689728498458862, 0.03518237918615341, 0.07009691745042801, -0.19125577807426453, 0.02577728033065796, 0.09395045787096024, -0.18436338007450104, -0.008771482855081558, -0.03880944475531578, -0.07904678583145142, -0.08571487665176392, -0.07486000657081604, 0.23530244827270508, 0.18752406537532806, -0.08982550352811813, -0.1298094391822815, 0.15410327911376953, -0.13385237753391266, -0.042741693556308746, 0.08568945527076721, -0.15939684212207794, -0.16694632172584534, -0.22865290939807892, -0.07053965330123901, 0.4003680348396301, 0.08202937245368958, -0.1801731437444687, 0.042903441935777664, -0.00935074407607317, 0.03642750531435013, -0.0022890842519700527, 0.06805362552404404, -0.08916033804416656, 0.04607487469911575, -0.10937654227018356, 0.05321456119418144, 0.19638413190841675, -0.008059857413172722, -0.029663337394595146, 0.12835454940795898, 0.007667573168873787, 0.05925054848194122, 0.07497074455022812, 0.048524536192417145, -0.10171215236186981, -0.06805070489645004, -0.18662872910499573, -0.022171152755618095, -0.016659731045365334, -0.04725855588912964, -0.05617832392454147, 0.10706578195095062, -0.21871164441108704, 0.09859132766723633, -0.006591768004000187, -0.032806698232889175, -0.12168025970458984, 0.09115643799304962, -0.012195411138236523, -0.005783792585134506, 0.0707741379737854, -0.2445700317621231, 0.10966287553310394, 0.1301625370979309, -0.13691042363643646, 0.150076225399971, -0.03438963368535042, 0.024646565318107605, -0.05649411305785179, -0.0008652610704302788, -0.14780545234680176, -0.14201171696186066, 0.010654862970113754, -0.017653966322541237, 0.06707234680652618, -0.01545938290655613],dtype=np.float64)

print "euclidean dist: ",np.linalg.norm(a-b)

Related Articles
Post a Comment