From fb79e584680e13277e3f20db30d68e7d5548b718 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 29 Oct 2025 17:24:11 +0100 Subject: [PATCH] AI: Adjust face recognition config defaults #5167 Signed-off-by: Michael Mayer --- internal/ai/face/config.go | 10 +++++----- internal/ai/face/embedding_test.go | 10 ++++++++++ internal/ai/face/embeddings_random_test.go | 8 ++++++++ internal/ai/face/embeddings_test.go | 9 +++++++++ internal/config/config.go | 4 ++-- internal/config/config_faces.go | 16 ++++++++-------- internal/config/config_faces_test.go | 16 ++++++++-------- internal/config/flags.go | 12 ++++++------ internal/config/options.go | 4 ++-- internal/config/report.go | 4 ++-- internal/photoprism/faces_match_test.go | 6 +++--- 11 files changed, 63 insertions(+), 36 deletions(-) diff --git a/internal/ai/face/config.go b/internal/ai/face/config.go index ec58cc1c1..cd418c822 100644 --- a/internal/ai/face/config.go +++ b/internal/ai/face/config.go @@ -17,19 +17,19 @@ var ( // ScoreThreshold is the base minimum face score accepted by the detector. ScoreThreshold = 9.0 // ClusterScoreThreshold is the minimum score required for faces that contribute to automatic clustering. - ClusterScoreThreshold = 15 + ClusterScoreThreshold = 20 // SizeThreshold is the minimum detected face size, in pixels. SizeThreshold = 25 // ClusterSizeThreshold is the minimum face size, in pixels, for faces considered when forming clusters. - ClusterSizeThreshold = 50 + ClusterSizeThreshold = 60 // ClusterDist is the similarity distance threshold that defines the cluster core. ClusterDist = 0.64 // ClusterRadius is the maximum normalized distance for cluster samples. ClusterRadius = 0.42 // MatchDist is the distance offset threshold used to match new faces with existing clusters. - MatchDist = 0.42 + MatchDist = 0.4 // CollisionDist is the minimum distance under which embeddings cannot be distinguished. - CollisionDist = 0.1 + CollisionDist = 0.05 // ClusterCore is the minimum number of faces required to seed a cluster core. ClusterCore = 4 // SampleThreshold is the number of faces required before automatic clustering begins. @@ -37,7 +37,7 @@ var ( // Epsilon is the numeric tolerance used during cluster comparisons. Epsilon = 0.01 // SkipChildren controls whether the clustering step omits faces from child samples by default. - SkipChildren = true + SkipChildren = false // IgnoreBackground determines whether background faces are ignored when generating matches. IgnoreBackground = true ) diff --git a/internal/ai/face/embedding_test.go b/internal/ai/face/embedding_test.go index 9823249ad..f21a0acfb 100644 --- a/internal/ai/face/embedding_test.go +++ b/internal/ai/face/embedding_test.go @@ -10,11 +10,21 @@ import ( func TestEmbedding_Kind(t *testing.T) { t.Run("Children", func(t *testing.T) { e := Embedding{0.00956450719281242, 0.017594281506414216, 0.0034308274819826088, 0.024433304607454274, 0.03652508157150199, 0.01116447955266469, -0.0006183593003596696, -0.0010943688685074449, 0.012357249196308354, 0.07457883842289448, 0.11295248899194929, -0.02418406752662526, -0.03966302269448837, -0.029571157983607717, 0.012989095386324657, -0.01884545675582356, -0.0069224719061619705, 0.03909949171874258, -0.02592672230417116, 0.013062778420539366, 0.015368576777594475, -0.009386404443325268, 0.038085957161254354, -0.07454640790820122, -0.08851962122652265, 0.03059599507186148, -0.002311327417070667, -0.026430425544579823, -0.06707751088672215, 0.02089460481268664, -0.01521601515479334, 0.030341569748189714, -0.0012923568590647644, 0.06852907459768984, 0.00929470748330156, 0.0015921768240837587, 0.01932051172479987, -0.005583951042758094, -0.028357081613244697, -0.015834319405257702, -0.007910402310598228, -0.010658817055324713, 0.01000140067966034, 0.053078942828708224, -0.030584194386998814, 0.015025267015314765, -0.013891826978781156, -0.006699096670167314, -0.060938968426651426, -0.053249146375391215, 0.02276569032013261, -0.04673161241225898, 0.016461304233719904, 0.045863549328512616, -0.04880381665296025, -0.034031555263532534, -0.026937679646329746, 0.03530077305104998, -0.05340263620018959, 0.04798200478156408, -0.025280179145435493, 0.02274432245434986, -0.07815711489982075, -0.00208588682128013, -0.020324266308711633, -0.04560547932568523, -0.026446496395187244, -0.04672709583408303, 0.03089646663930681, 0.0329096753978067, -0.0031386990772767197, 0.0030701529855529466, 0.01198785288983749, -0.0720665372080273, 0.016065222754453618, -0.008565091230492625, -0.06524603068828583, 0.014324400331436967, 0.012642266590976052, 0.03916913395126661, 0.017239611298363242, -0.0022940708117352594, -0.00000737705785367224, -0.013188478122982714, 0.023865339604930744, 0.08236957093079884, -0.019251494202762842, 0.05471697532468372, 0.005972680687490437, 0.040493461613853775, -0.0688300368686517, 0.004474718201284607, -0.04370514086137215, 0.008753968299263053, 0.07228374770945972, 0.007629580582336833, 0.03886009587181939, 0.08576714330249363, -0.021909458562731743, -0.010310174200438067, 0.011320573885718154, 0.05167221174471908, -0.011920124732164873, 0.09136995921532313, 0.07861344681845771, -0.02466051270150476, 0.03293021395802498, -0.031370491824216314, -0.006256768428203132, -0.028057354321289394, -0.001464772762523757, 0.015254409194716977, -0.02345223191918598, -0.11720789555046293, -0.03956084408693843, 0.017618920240137313, 0.02171551130918993, 0.000804237904958427, 0.0040997833841376835, 0.05092603630489773, 0.010734342167981796, -0.024763399010731116, -0.05916011126505004, 0.013965856510266248, -0.015584999747160409, -0.07232196339302593, 0.00037505472492840554, -0.004479492106636624, 0.006297527954706715, -0.043400421945585146, -0.02631447795364592, 0.06060819741752413, 0.06364250307281812, -0.014363453361309238, 0.0452708558489879, 0.02589565556910303, 0.010107092559337616, -0.04670443137486776, -0.054579869016177125, 0.1046515769428677, 0.029628220428195264, 0.019528768439259794, -0.05553832401831945, 0.07381440409355694, -0.06197152224679788, -0.03346837612075938, -0.028401009428004425, 0.045492336774865784, -0.014222729860598015, 0.052605656906962395, 0.028711968515482213, -0.006189175881445408, -0.039265539290176496, 0.017252425456212625, 0.018786909783052072, 0.013216451851702813, -0.07228060687581699, 0.06143035077386432, -0.029247661742071312, -0.07368612289428711, 0.06836203527119425, 0.045540636819269925, -0.06008780002593994, 0.053936791916688286, 0.016778231805397406, -0.006840274158296072, -0.053641265258193016, -0.027871736118363008, 0.025869831843819056, 0.071573406457901, 0.014396547469206981, -0.009195981288535727, -0.07452616840600967, 0.013345200232935086, -0.016935504455533292, 0.049057218349642225, -0.01680893502715561, -0.014038488268852234, -0.022829299352856144, -0.059434341887633, -0.012434359924453828, 0.04231061150009433, 0.01735861397658785, 0.052751378466685615, 0.035937425990899406, 0.0220693277919458, 0.09581007974015342, 0.052584730088710785, 0.04224762465390894, 0.03516049683094025, 0.05461937189102173, 0.027251388049787946, 0.04605957410401768, -0.05316027129689852, 0.07284069102671412, -0.03601164950264825, -0.03515230264100763, 0.024848973895940516, 0.018131214219869837, -0.0005673166467911667, 0.09281168133020401, -0.01841116055018372, 0.04431105674140983, -0.022182180391003687, -0.0011550109031506712, 0.1312924474477768, 0.01592384051117632, 0.011137459174885104, 0.024446219205856323, 0.007765962380088038, -0.043042239215638906, -0.054043336460987725, 0.026125866919755936, -0.05938888258404202, -0.01505894141478671, -0.07235014769766066, 0.025598893976873822, 0.06189072959952884, 0.010129067490601705, 0.0798807301455074, -0.011724631618967073, -0.027017276161738362, 0.04092693328857422, -0.015599953812650509, 0.045602697051233716, -0.018599940256939992, 0.010273827201065918, 0.03422223191915287, -0.06518438417050573, 0.03480341430339548, 0.010534410752976934, 0.05929994355473253, -0.1059915026028951, -0.004690915671138403, 0.0176001051440835, -0.028789587318897247, -0.0008820632776607656, -0.01912516790131728, -0.03659702175193363, 0.02925850057767497, -0.006651972692149381, 0.03585423529148102, 0.004146564590175533, 0.07956291197074784, 0.011424321487235526, 0.06981112021538946, -0.012405176181346178, 0.045626538081301585, 0.03736268056349622, 0.04791162866685125, -0.00340089900419116, 0.024297866853885353, 0.10473044878906673, -0.058053700460328, -0.0478491158121162, 0.02280241163033578, -0.04503581734995047, 0.05154827834727863, 0.04939925236006578, -0.0032965411535567707, 0.024689303762796853, -0.03474749873081843, 0.04177183575100369, 0.0612266067829397, -0.017530236755394273, -0.002992505000697242, 0.038245580780009426, 0.029071697654823463, -0.0017085750199233491, -0.06656611462434132, 0.017400852262249425, -0.032034329863058195, 0.01248814820105003, 0.038716979428297944, 0.026905361666447587, 0.028665946796536446, -0.029912837884492345, 0.0011884293182649547, -0.07279362322555648, -0.018983382317754958, -0.0682681186331643, 0.10368894537289937, -0.006382284530748923, -0.04440281209018496, -0.08117666881945398, -0.030362199578020308, 0.0378638267931011, 0.008926777194978463, -0.008873912919726636, -0.018600086940245494, 0.039435300769077405, -0.04833844924966494, -0.005534950776361964, 0.04187685540980763, -0.00920979937331544, -0.06032300740480423, 0.04529076235161887, -0.017920835289664358, -0.009011213628885647, -0.04398277898629507, -0.011301302079421779, 0.03356585796508524, -0.06062525371089578, 0.010255272189776102, 0.029481254854343004, -0.0019921630672696563, -0.03161581791937351, 0.018223024904727936, 0.028269319277670648, -0.01717748982708953, 0.003151409237438606, 0.03445811424818304, 0.013116849948548608, -0.03361893124464485, 0.11243294345008002, -0.02414778031137151, 0.0009398051123652193, 0.03513648216095236, 0.07822070995138751, -0.06039799335930082, -0.046241684506336846, 0.01664898373888314, -0.022302107587974105, 0.023223551197184458, -0.03896974565254317, 0.02107381272233195, 0.014257466317050986, 0.08389275272687276, 0.06136741447779867, 0.02696629727466239, 0.025725652567214437, 0.03333099941826529, -0.06944898805684513, 0.03385308446983496, 0.03951059985491964, 0.05811662061346902, 0.04349600813455052, -0.02805554157950812, -0.05582492627824346, -0.05247949043081866, 0.04473223413030306, -0.0070410499400976635, 0.01720123179256916, -0.021176138970380027, -0.03261649919052919, -0.02008709663318263, -0.02541356365610328, 0.030320773625539407, -0.02636879589408636, -0.02746961617635356, 0.004731823146964113, 0.05784605319301287, -0.008771000119547049, 0.002482125690827767, 0.03873592014941904, 0.013244514612274038, 0.016256491776504036, 0.039643339812755585, -0.04349886460436715, -0.024448473394537967, -0.025856203503078885, 0.021381820138129923, -0.04026743065979746, -0.07614113349053594, -0.024597936309874058, -0.025117785876823798, -0.007596029369677935, 0.01889244622240464, 0.00006782920617196296, -0.027720228872365422, -0.04852603831224971, -0.045822552094856896, -0.004668864376273834, 0.04860494968791803, -0.00599650407416953, 0.029392837443285517, 0.07024536571568912, 0.046713153935141034, -0.03505657706409693, 0.032767738836507, 0.03666515834629536, -0.06098963278863165, -0.02862372797810369, 0.010534445004951622, 0.05224730529718929, -0.043354966367284455, 0.021389764681872394, 0.020172426477074623, -0.0013402456663445467, 0.03145651849141965, -0.015751932592441637, 0.039305776771571904, -0.024094444130443864, 0.023116414435207844, 0.0010459598803815122, -0.03311869822856453, -0.04304084005869097, 0.035308302380144596, 0.02648943393594689, -0.0433658417314291, -0.030366347067885928, -0.03036927328341537, 0.09163435217407015, -0.007137416861951351, 0.04118875631441673, 0.04462467837664816, 0.0186937279585335, -0.03797590256565147, 0.04514540338681804, -0.008639660534552403, 0.0762030142876837, -0.0134583566751745, 0.022655908277051315, 0.004643273462230961, -0.08652641003330548, 0.013738796567647822, -0.01377079894559251, -0.024995700663162604, -0.030371163143879838, -0.030448109946317144, 0.10791386249992582, -0.030183505473865405, -0.005543621140532196, 0.008693856497605642, -0.04184898133907053, 0.08765134463707606, -0.02371981895218293, -0.06641878601577547, 0.03483888072272142, -0.03773280315928989, -0.0074731065089710886, 0.003471121376302714, 0.023200226844184928, -0.01573064975026581, 0.04564601777949267, 0.021612754712502163, -0.060529693961143494, -0.013140015716392858, -0.07159835886624125, -0.02568271808559075, -0.11435804019371669, 0.06617429562740856, 0.01995501708653238, 0.06415391175283326, 0.008545574770929912, -0.018575870121518772, -0.03251912569006284, 0.016798952232218452, -0.018335888563241396, -0.06809450437625249, -0.019734525406319234, -0.00015986069209045835, 0.061214266137944326, -0.020642005088221695, -0.04399915991557969, 0.0065624537463817335, -0.033284927614861064, 0.116939311226209, 0.06487316679623392, -0.0008064880967140198, 0.0827075880434778, 0.1045238475004832, 0.08511008736160067, -0.02596275084134605, 0.011347602431972822, 0.014439393759756867, -0.038869811635878354, -0.032146183508707, -0.008580799059321484, -0.0341539511250125, 0.011072635081493191, -0.1035624932911661, -0.029690628353920247, -0.0640309527516365, -0.05696413459049331, 0.042117324036856495, 0.07128431068526374, 0.040064464840624064, 0.005983394088010148, -0.00667726600335704, 0.047270469160543546, 0.005897726627558263, -0.0368763098700179, -0.023564390579445496, 0.006459848179171483, 0.009426389351978691, -0.047467888643344246, 0.03504645437674804, -0.005881637114928001, -0.09620188259416157, -0.025261664763092995, -0.04608574716581239, -0.0177506600610084, 0.06423448212444782, 0.03958735977196031, 0.011297762950157953, -0.004669215297326446, -0.002415396169655853, 0.06259037305911382, -0.029752894615133602, -0.0592656247317791, -0.01600239688478824, 0.04226608822743098, -0.011972974494306577, -0.012937591902704703, -0.006532240995309419, 0.014907695611731874, -0.002943116544176721, 0.03677781733373801, -0.04577133432030678, -0.011399532060345842, 0.029993985469142597} + originalValue := SkipChildren + SkipChildren = true assert.Equal(t, ChildrenFace, e.Kind()) + SkipChildren = false + assert.Equal(t, RegularFace, e.Kind()) + SkipChildren = originalValue }) t.Run("Background", func(t *testing.T) { e := Embedding{-0.00067741907, -0.0473858, -0.055704225, 0.066581585, 0.005290037, 0.03822874, -0.05082791, 0.049087, 0.018308854, -0.01478969, -0.0017964382, 0.057903986, -0.02245441, -0.033446193, -0.0071987803, -0.03150515, 0.017724376, 0.019948162, 0.056362633, -0.11701946, -0.09725581, 0.013104323, 0.07357148, -0.020104313, -0.014956488, -0.017257847, -0.020743687, -0.046340823, -0.021527996, 0.057039287, -0.051751148, -0.00595411, 0.011733857, -0.04644382, -0.028774152, 0.038308877, -0.015685631, 0.0038190065, -0.094677314, 0.07005245, -0.003068884, 0.050274804, -0.018143218, 0.012056174, 0.019058047, -0.00077958487, 0.030408988, 0.0885491, -0.11106459, -0.019910613, 0.01465938, 0.032499526, 0.04720623, 0.03163276, -0.079508044, 0.07914293, 0.03724754, 0.05636608, -0.016979787, -0.04298359, -0.03599786, 0.058342796, -0.024069536, -0.03200436, 0.015390179, 0.07293075, -0.0013783299, -0.01605161, -0.0045498423, -0.016551308, 0.060823392, 0.073548146, -0.021239666, -0.036749583, 0.00028047478, -0.025989566, -0.05310693, -0.009845653, -0.012862101, 0.058108855, 0.06915682, 0.021099294, 0.001225616, 0.033261415, 0.042154703, 0.05271609, -0.030613305, 0.041209485, 0.0019353209, -0.0019135632, 0.080911145, 0.011060149, 0.05281461, -0.10160427, 0.053647887, 0.01762615, -0.018661015, 0.02777136, -0.056023918, 0.057687696, 0.06513923, -0.069180146, -0.015231091, 0.03774808, 0.012945786, 0.090585396, 0.019942591, -0.015280875, -0.0011742035, -0.042135417, 0.05812486, 0.05519544, -0.06453465, -0.04014237, -0.03199121, 0.009241696, 0.043912023, 0.015467731, 0.0020673021, 0.08763925, -0.08974939, -0.05304043, 0.016309343, -0.04766073, -0.0046682972, -0.040477246, 0.012679025, 0.005960806, -0.03256039, -0.07089416, -0.02648642, -0.062463485, 0.08295411, -0.037147924, -0.074104264, 0.077417135, -0.042383663, 0.002088579, 0.07709948, 0.06521331, -0.07541816, 0.057679284, -0.0038482754, 0.055191133, 0.058614884, -0.018541405, -0.012277692, 0.057926673, -0.01724738, 0.020869015, 0.046103075, -0.0319926, -0.0671411, 0.02629761, 0.044356663, 0.036788594, 0.028035736, 0.06419986, 0.045972086, -0.044160895, 0.09784713, 0.00953585, -0.06252615, 0.025597766, 0.029688764, 0.027506752, -0.055384982, -0.028262418, -0.057812758, 0.042470966, -0.05840525, -0.03801629, 0.0043816785, -0.015086851, 0.022297874, 0.054110903, 0.07420415, -0.040949743, -0.08912868, -0.060081407, -0.046966024, -0.04826231, -0.031198893, 0.06643161, 0.01347482, 0.029003717, 0.047974125, 0.07580259, 0.0364837, 0.012980756, 0.020622224, -0.022555852, 0.10519882, -0.03425076, 0.03889103, -0.007944982, 0.060116176, 0.038143042, -0.043681793, 0.05316621, 0.0016697546, -0.0033659195, 0.020053076, -0.07204762, 0.009732797, 0.03862544, 0.03913928, -0.009832126, 0.06401315, 0.044209804, -0.051490918, 0.014780334, -0.025438532, -0.01395564, -0.038089562, -0.009803314, -0.04146325, 0.03357636, -0.009009651, 0.04373462, -0.05627207, -0.072068065, -0.007331119, -0.04238925, -0.021102922, -0.021610938, -0.063095644, -0.05075978, -0.07491732, 0.0113026835, 0.04940704, 0.084163934, -0.01636119, -0.06292533, -0.014526007, -0.007826649, 0.07212185, 0.004734863, -0.062791124, -0.016170232, -0.016590146, -0.024280416, -0.019522576, 0.01579864, 0.002749153, 0.053687476, -0.016495354, 0.03662209, -0.018870195, 0.039446633, 0.04715818, 0.013310755, 0.028033575, 0.067203104, -0.005826697, 0.042239364, -0.020745477, 0.0015561507, 0.065384425, 0.09041862, 0.01788624, -0.010026493, 0.0639752, -0.0041079777, -0.058741663, 0.034099422, 0.016963305, -0.0052649197, -0.07403116, -0.0029912698, -0.07583906, 0.001012409, -0.029492352, -0.04166984, -0.048218843, -0.06306306, -0.0033243645, -0.02919451, 0.0039520795, -0.037993237, 0.044352133, 0.03976749, -0.030565975, -0.076377496, -0.06569797, 0.01630497, 0.017201763, 0.028935125, 0.004058029, -0.09946857, 0.036038112, -0.06792709, 0.04493338, 0.035801385, -0.048764315, -0.06326099, 0.037968885, 0.038012274, 0.038041856, 0.04288072, 0.01531972, 0.032477308, 0.043926656, -0.0077148937, 0.056322563, -0.03451439, -0.0083661955, 0.0015379508, -0.007879496, 0.01986026, -0.019533899, 0.0405012, 0.015047856, 0.04601962, 0.080275685, 0.017424034, -0.032671392, 0.024088044, -0.021807125, 0.010775311, 0.094901696, 0.0048406925, 0.013086048, 0.04339756, -0.0069915624, 0.019183818, 0.0624931, 0.019509323, 0.07727781, 0.071851335, 0.046544127, 0.040363774, -0.027118236, 0.06800823, -0.01851149, 0.039025713, -0.037301723, 0.05617681, 0.027737545, -0.0011841523, 0.034742635, 0.006083848, 0.033872508, 0.012025738, -0.02354928, -0.07461171, 0.0027702893, 0.04646551, 0.06590462, -0.00794524, -0.011096932, 0.031695057, -0.06732352, -0.051879242, -0.0773121, -0.000517982, 0.08113213, -0.015312499, 0.018544769, -0.023654874, -0.01689197, 0.026425209, -0.08191027, 0.03139842, -0.011997609, 0.059896134, 0.07505033, -0.012907369, 0.008597082, 0.007715897, -0.07062183, -0.027084265, 0.0028182073, 0.03769887, 0.034299187, 0.046780333, -0.007847023, -0.051446356, 0.007982996, -0.034917314, -0.0038174198, -0.05954771, -0.044208106, 0.04685703, -0.0199229, -0.0032713648, 0.009684984, -0.050678924, 0.007356914, -0.06628045, 0.042982273, 0.0055478252, 0.011330174, -0.082057334, 0.026437566, -0.015942575, 0.048285805, -0.003856138, 0.04399534, 0.01741405, -0.059217025, 0.056499016, -0.03459506, 0.030366927, 0.016147505, -0.021027595, -0.013333387, -0.035330992, 0.0445699, -0.03483558, 0.02072434, -0.019552084, -0.0043943045, -0.03957101, 0.0041682394, 0.006047565, 0.03504845, 0.04675005, -0.021805461, -0.0033183587, -0.0017508261, 0.033419013, 0.008266579, 0.067113, -0.026226636, -0.020189233, 0.029219048, 0.031028047, 0.021648621, -0.055164326, -0.008505359, 0.05173594, 0.016450783, -0.017234024, -0.10492493, -0.04954522, 0.024168914, -0.008840458, -0.078473605, -0.042714797, -0.040692057, -0.05446264, 0.0148880705, 0.057658363, 0.005458192, 0.02171352, -0.04556389, 0.017333247, -0.10342444, -0.06159851, -0.03170678, 0.08064648, 0.024460033, -0.07185376, -0.0019515441, -0.026248276, 0.034460787, 0.08695437, 0.06363327, 0.012909266, 0.00093975884, 0.03682474, -0.041370448, -0.0070990156, 0.058603138, -0.038166087, -0.039693672, 0.025385896, 0.0035452761, -0.015794974, 0.019059189, -0.028707229, 0.038948998, -0.032039847, -0.07992934, -0.05482927, 0.048767164, -0.03186542, 0.059099294, 0.063702375, 0.01810526, -0.019284561, 0.036313917, 0.0006970895, 0.020730797, 0.08630282, -0.10650717, 0.0017196184, 0.023258938, -0.021214833, 0.015206377, -0.027243242, -0.021319263, -0.054438062, 0.066603355, -0.047786396, 0.018822387, -0.031346995, -0.0049103773, -0.020732613, -0.0841506, 0.00707288, -0.0033278253, 0.068160556, -0.011127404, 0.05533654, 0.0046188673, 0.039132893, 0.008633137, -0.057081457, -0.030337824, -0.0721918} + originalValue := IgnoreBackground + IgnoreBackground = true assert.Equal(t, BackgroundFace, e.Kind()) + IgnoreBackground = false + assert.Equal(t, RegularFace, e.Kind()) + IgnoreBackground = originalValue }) t.Run("Regular", func(t *testing.T) { e := Embedding{-0.037731018, -0.005501065, 0.04339579, 0.050818004, -0.059338734, 0.033849984, -0.006599584, -0.0017643301, 0.049746443, -0.103716515, 0.037138782, -0.0064612515, 0.071909964, 0.013218528, -0.065359734, 0.11057091, 0.031195551, 0.025612833, 0.0075477255, -0.034973715, -0.013490629, -0.08104751, -0.022038054, -0.05304818, 0.008366317, -0.056096837, -0.008484318, 0.049539477, 0.019540254, 0.067417614, -0.027856546, -0.008532138, -0.017063588, -0.00016265438, -0.106199585, 0.03904082, 0.030587498, 0.043008707, -0.015111545, -0.022849092, 0.0025588698, -0.012814152, 0.037556626, -0.0086288145, 0.05265788, 0.011832273, 0.00015048613, -0.0081366515, 0.0013409692, 0.028389124, 0.022627315, -0.015008434, -0.0007749727, 0.013927345, -0.012275729, -0.0090859635, 0.019502806, -0.011900984, 0.016286656, 0.08094661, 0.000306613, -0.06327904, 0.018552454, 0.08885108, -0.07583091, 0.09275318, -0.018484656, 0.074180886, -0.039385945, -0.08063905, -0.05360434, -0.037074074, 0.09909196, 0.025063906, -0.009406389, -0.029612983, -0.018644262, 0.08433939, -0.04466277, -0.07118042, -0.0053266245, -0.07471344, 0.06739151, -0.05399609, 0.03125197, -0.00007781149, -0.04214992, -0.044316035, 0.025013437, 0.031466946, 0.0023496088, 0.042693187, -0.046198968, 0.026152546, -0.017578958, 0.023763098, 0.027511515, -0.05229892, -0.005204117, 0.035853546, -0.031919815, -0.027175877, -0.033706605, 0.018576957, -0.0010251165, -0.006808904, 0.009910016, -0.046926413, -0.02833718, 0.0132687995, -0.033933964, 0.06434295, 0.046245363, 0.044698197, 0.041076522, 0.04224362, -0.050834127, 0.0037004466, 0.061506275, -0.018232772, 0.067569405, 0.048701495, 0.042266034, -0.11045008, 0.03627151, -0.07259142, -0.0027725939, 0.040572345, 0.010365194, -0.018683784, 0.004533848, 0.037213936, -0.050944775, 0.07134523, 0.004012727, 0.036228556, -0.013853831, -0.06910639, -0.011394227, -0.012075533, 0.036311198, -0.02587341, -0.04086224, -0.024498813, -0.019423751, -0.022674281, 0.052483488, 0.026303312, -0.051178075, 0.008410645, 0.039851066, -0.028721321, -0.027934253, -0.029567441, 0.054549955, 0.07423011, -0.07211806, 0.015979288, 0.002092099, 0.049062036, 0.025120452, 0.045975365, 0.025024865, -0.04019101, 0.0013054911, -0.0049644294, 0.0065203104, -0.03237452, -0.020704443, 0.028736785, -0.027353559, 0.07551169, 0.0842262, 0.019992182, 0.11138123, -0.028617613, 0.06700691, -0.048681036, -0.008201593, -0.058066163, 0.027867565, 0.07693089, -0.033642102, -0.05855467, -0.08575646, -0.019721355, 0.018443357, -0.0037373751, 0.032450553, -0.0074002664, -0.028135147, 0.046631414, 0.0192969, -0.0071076434, -0.004898368, 0.011896125, -0.026020564, 0.074016415, -0.033884488, -0.07919758, 0.021606326, -0.0142197255, 0.0807476, 0.03722956, -0.0015949347, 0.008076167, -0.009640628, 0.02341143, 0.015375526, -0.059428506, 0.051759534, 0.028049389, 0.07790443, 0.0478649, 0.09191913, -0.055882096, -0.026637457, 0.01236174, -0.0033003334, 0.008522798, 0.027216703, -0.033221588, -0.028086975, -0.11505473, -0.044336796, 0.013873659, 0.03982099, 0.060988583, -0.07439005, 0.01333661, -0.004818605, 0.02561305, -0.059055943, 0.0081638545, -0.032278564, 0.046092775, 0.025316834, -0.046857174, -0.0341012, 0.04379944, -0.029710777, 0.09238533, 0.009769442, 0.018552538, -0.02632421, 0.033739865, -0.022547472, 0.016400741, -0.05336998, -0.012623122, -0.08303054, -0.010368709, 0.01690871, 0.0014627968, -0.050720602, 0.038742293, -0.065664165, -0.10676187, -0.013403239, 0.075702645, -0.055623896, -0.03871971, -0.042371742, 0.03794916, -0.0590573, -0.002583715, -0.029995736, -0.08144537, -0.043295015, -0.034286328, -0.026538746, 0.01953962, 0.08203153, 0.036415525, 0.045531306, 0.004713152, 0.026550433, -0.0055336948, -0.031087596, -0.01923592, -0.1047651, 0.051826596, -0.009522955, 0.0023846119, -0.030824797, 0.0011774554, 0.03384506, 0.010090165, -0.033521466, -0.052155476, 0.0032979914, -0.004305921, -0.08622774, 0.03262125, 0.06332183, 0.00067599304, 0.01989574, 0.04406689, 0.019945903, -0.003796719, 0.00025200442, -0.010055775, 0.04070448, -0.004082432, -0.026942603, 0.110138796, -0.029453337, 0.015611174, 0.08778206, -0.027199872, -0.014513782, 0.021546016, 0.01706933, -0.01365763, 0.026393317, -0.029974515, 0.0050973813, 0.00732006, 0.034644503, 0.03125295, -0.01563078, -0.041023903, -0.04566191, -0.00013489528, 0.04253813, 0.045907266, -0.011943533, 0.031480506, -0.0034109016, -0.035025172, 0.028193155, -0.06832476, -0.0019371725, -0.049427234, -0.0061696135, 0.051213425, 0.07832765, -0.01894849, 0.0290217, 0.031639505, -0.045830216, -0.048976466, 0.052241277, -0.026111973, 0.037248738, -0.07693719, -0.00020981894, 0.030037824, -0.041687537, -0.015251262, 0.041234106, 0.031005232, 0.024838371, 0.0020733695, -0.038252156, -0.026375879, 0.03495583, 0.018539391, -0.07203285, 0.006305707, -0.004792029, -0.05153865, 0.0072443904, -0.017075827, 0.013596034, -0.0054885144, -0.052320853, -0.033805914, -0.038080305, -0.010182737, 0.012953395, 0.014565793, -0.023107765, 0.030313661, 0.011124675, 0.018100796, 0.1074551, -0.074430406, -0.04017658, -0.002058053, -0.07340946, 0.0033503077, 0.04565434, -0.033483636, -0.029218825, -0.05245377, -0.059680052, 0.017752757, -0.05493096, -0.10746678, 0.08623605, 0.014577705, 0.0044184765, -0.025559181, -0.015846781, -0.006661373, 0.09459266, 0.036481388, 0.030402042, -0.0152169075, 0.0037343376, 0.024195764, -0.01859682, -0.0022416788, 0.0056786016, -0.06771737, 0.02364697, 0.021247962, 0.05002757, 0.083975114, 0.011197936, 0.0035017033, -0.0014220127, -0.024415374, 0.023921741, -0.0108229555, -0.06622103, -0.00024976654, 0.06549428, -0.004968772, -0.011665843, 0.03409593, 0.028397659, -0.086434126, -0.074232705, 0.041721817, -0.034767248, -0.014432104, 0.006313255, 0.04040112, -0.0050085387, -0.0023618732, -0.02225774, 0.02383989, 0.061036374, 0.058602326, 0.04343989, -0.029145751, 0.0369256, -0.054843802, -0.017078603, 0.047091234, 0.050245833, -0.04615808, -0.02404996, 0.02584908, -0.006215116, -0.016719814, 0.052097827, 0.01908364, -0.07564805, -0.11024787, -0.036854018, -0.0056766514, -0.007618422, 0.034403287, 0.056957226, -0.03565076, -0.0365251, 0.040833052, 0.008173664, -0.04300709, 0.0028465139, -0.020792698, 0.020321466, -0.002447697, 0.019681728, -0.08843341, -0.042670425, 0.014576458, 0.009701015, -0.12435015, -0.025056241, 0.03084893, -0.031128377, 0.006784327, 0.052201632, 0.06773422, 0.015289244, 0.009421969, 0.0725144, -0.07110377, -0.05183192, -0.008816121, -0.11178569, 0.079700254, -0.0110752955, 0.0046521816, -0.07299747, 0.10732809, -0.06012486, 0.057736155, -0.02227576, -0.063017495, 0.085292354, 0.037407015, -0.07368719, 0.033426613, 0.062104296, -0.016089993, -0.023178348, -0.064638525, 0.028132388, -0.049967688, 0.053581465, 0.031400185, 0.0712773, -0.012665878, 0.0760322, 0.030081542, -0.022147592, 0.009422989} diff --git a/internal/ai/face/embeddings_random_test.go b/internal/ai/face/embeddings_random_test.go index 8654d6c7a..7de2eff0a 100644 --- a/internal/ai/face/embeddings_random_test.go +++ b/internal/ai/face/embeddings_random_test.go @@ -15,6 +15,14 @@ func TestRandomDist(t *testing.T) { } func TestRandomEmbeddings(t *testing.T) { + skipChildren := SkipChildren + ignoreBackground := IgnoreBackground + t.Cleanup(func() { + SkipChildren = skipChildren + IgnoreBackground = ignoreBackground + }) + SkipChildren = true + IgnoreBackground = true t.Run("Regular", func(t *testing.T) { e := RandomEmbeddings(2, RegularFace) for i := range e { diff --git a/internal/ai/face/embeddings_test.go b/internal/ai/face/embeddings_test.go index 26ad39055..eb7978d07 100644 --- a/internal/ai/face/embeddings_test.go +++ b/internal/ai/face/embeddings_test.go @@ -43,6 +43,15 @@ func TestBackgroundSamples_Count(t *testing.T) { } func TestBackgroundSamples_Kind(t *testing.T) { + skipChildren := SkipChildren + ignoreBackground := IgnoreBackground + t.Cleanup(func() { + SkipChildren = skipChildren + IgnoreBackground = ignoreBackground + }) + SkipChildren = true + IgnoreBackground = true + regular := Embeddings{Embedding{0.03299243375658989, 0.0012887970078736544, 0.0036446317681111395, 0.031202086247503757, 0.02730374224483967, -0.016643289010971785, -0.02336998051032424, 0.05498751252889633, -0.010465491970535368, 0.018875301582738757, 0.014203066239133477, 0.11920119822025299, -0.042420363053679466, 0.04395093023777008, -0.041016378439962864, 0.09627663344144821, 0.06980812922120094, 0.03829829953610897, -0.026089582592248917, -0.026732983998954296, 0.04984568804502487, -0.008000173838809133, 0.049577487632632256, -0.013628015061840415, -0.02461838547606021, -0.0773920863866806, -0.017194374231621623, 0.032989165745675564, -0.017070180736482143, 0.012035661202389747, -0.06164510361850262, -0.11613136157393456, -0.012980560306459665, -0.05340278521180153, -0.05773849040269852, 0.043240783736109734, 0.017606624809559435, -0.061572352424263954, -0.009708077413961291, -0.008284036070108414, -0.03199474699795246, 0.0706041008234024, 0.032686786726117134, 0.04332643933594227, 0.01367653300985694, 0.10158828273415565, 0.04595570266246796, 0.0482933409512043, 0.0013564485125243664, 0.040155623108148575, -0.03153740335255861, -0.020297469571232796, 0.060823097825050354, -0.022422337904572487, 0.003214967844542116, -0.005922295735217631, 0.029318060725927353, 0.02124825958162546, 0.0087385019287467, -0.04913809150457382, -0.07493386417627335, 0.04034857079386711, -0.022440982051193714, 0.052591606974601746, -0.014183513354510069, 0.020259365905076265, -0.03143961448222399, 0.053309688344597816, 0.09904120117425919, -0.01861259969882667, -0.00825246050953865, -0.00006514322012662888, 0.10538545623421669, -0.001551960885990411, -0.011002717074006796, -0.03310613660141826, -0.024139931425452232, 0.0028643521363846958, -0.03557338588871062, 0.026428129989653826, -0.01326784840784967, -0.05814123898744583, -0.012879705056548119, 0.052929580211639404, -0.02772670704871416, 0.0013385144993662834, -0.027945382753387094, 0.003164151683449745, -0.029322932474315166, -0.010705097345635295, -0.024460318207275122, 0.09913501888513565, -0.02091354748699814, -0.029340512584894896, -0.03533128276467323, -0.0015429016202688217, -0.03142521344125271, 0.048838695511221886, -0.004869261756539345, 0.018591410014778376, -0.0013430897961370647, 0.0693020261824131, -0.07708260789513588, 0.03203477058559656, 0.033085787668824196, -0.047355168499052525, 0.042945362627506256, -0.03789123799651861, 0.03710726834833622, 0.002974637900479138, 0.026817279402166605, -0.019838752574287355, 0.017452094238251448, 0.011397800408303738, -0.0007858939352445304, -0.07874647155404091, 0.03014033380895853, -0.03141150251030922, -0.0038211997598409653, -0.05815695598721504, 0.015130200888961554, -0.00583213334903121, 0.02310820948332548, -0.09213608130812645, 0.012645000591874123, 0.0012694697361439466, 0.021815909654833376, 0.04155354108661413, 0.02388177369721234, -0.015529894386418164, -0.051616192795336246, 0.010208874300587922, -0.03290301887318492, 0.010450892033986747, -0.027349266223609447, 0.06710228323936462, -0.06247733533382416, 0.06953012570738792, 0.0532703660428524, 0.019448445178568363, 0.01020348072052002, -0.0035300063900649548, 0.0013424362987279892, -0.01938025653362274, 0.04580975882709026, -0.02403993345797062, 0.006522719166241586, -0.04139801021665335, 0.0716425608843565, 0.05525396205484867, 0.058247946202754974, -0.06575375609099865, -0.021414507646113634, 0.03050460765371099, -0.0003104889765381813, 0.032245068810880184, -0.04928449168801308, -0.020805996377021074, -0.10028348118066788, -0.003723388770595193, 0.01698605390265584, -0.01518161385320127, -0.02763783186674118, 0.07887725159525871, 0.0034282272681593895, 0.003735181875526905, -0.015192683786153793, 0.042410291731357574, -0.08484236150979996, -0.04384550638496876, -0.020871759159490466, -0.07331935688853264, -0.03693169914186001, 0.05979561619460583, 0.07535402476787567, 0.03485331777483225, 0.03948853723704815, 0.04505305550992489, 0.041757065802812576, 0.03698613494634628, -0.07742167450487614, -0.04953393340110779, -0.011866949324030429, -0.06310526095330715, -0.037923854775726795, -0.06733793206512928, 0.0028253942728042603, 0.008544581476598978, 0.018204851308837533, -0.01110428711399436, 0.028675229288637638, -0.000014176592230796814, -0.008595517836511135, -0.010980478953570127, 0.06090782955288887, 0.031935724429786205, -0.06428571417927742, 0.02687774132937193, -0.02820626273751259, 0.06103776954114437, -0.014799649827182293, 0.06487447768449783, -0.017612767405807972, -0.0489738117903471, 0.06415916979312897, 0.04622162878513336, 0.028768808580935, 0.008490341948345304, 0.0034207233984488994, -0.030166614800691605, 0.00037564802914857864, 0.08484940975904465, 0.0556329358369112, -0.008680319762788713, -0.0591686237603426, 0.013132395455613732, -0.04138460196554661, -0.0152534618973732, -0.0008955895900726318, -0.0006699399091303349, -0.06126082316040993, -0.003050922998227179, 0.07981977239251137, -0.00553199223941192, 0.05290817841887474, 0.040990181267261505, -0.08198415860533714, 0.012562283780425787, 0.019035696983337402, 0.03838503547012806, 0.009997975939768367, -0.054437462240457535, 0.025413839612156153, -0.012672057142481208, 0.027240466326475143, -0.10823043063282967, 0.039526550099253654, 0.023417172953486443, 0.010616711806505919, 0.05400657467544079, 0.014769354253076017, -0.03666005376726389, 0.1403786465525627, 0.0018849256448447704, 0.016372513491660357, 0.035192170180380344, -0.04371563345193863, 0.01762180813238956, 0.03151775896549225, 0.0017134752124547958, -0.002189646300394088, -0.026309426873922348, -0.022467125672847033, 0.03452171664685011, -0.005091295926831663, -0.012717211386188865, -0.01844012923538685, 0.08377647772431374, 0.04330274369567633, -0.012911015888676047, -0.07783931121230125, 0.022803466767072678, -0.009209758485667408, -0.01134668372105807, 0.0010978481732308865, -0.041731768287718296, -0.019449530635029078, -0.06525786221027374, 0.01784832403063774, 0.0519381258636713, -0.04546765796840191, -0.06681095622479916, 0.052901409566402435, -0.014712406322360039, -0.06206769123673439, -0.029490199871361256, -0.00992094405228272, 0.030980206094682217, 0.028731123558827676, -0.030716994777321815, 0.015335452044382691, 0.027196447364985943, 0.006802443356718868, -0.049035536125302315, -0.01397545076906681, 0.025320623070001602, -0.030315839685499668, 0.008192180190235376, 0.05064524710178375, 0.055071935057640076, -0.02402257511857897, -0.026291001588106155, -0.0352883143350482, 0.03816434368491173, 0.0024908103223424405, -0.056645095348358154, -0.0033702882938086987, -0.005905752768740058, -0.06425020284950733, -0.05919185280799866, -0.0016906238161027431, 0.0367411058396101, -0.013534991536289454, 0.04554910026490688, 0.04965145606547594, 0.04711329936981201, -0.0022945720702409744, -0.08543642237782478, -0.008514909524819814, -0.028528734110295773, 0.061780987307429314, 0.020181911531835794, -0.0911903902888298, 0.05051926709711552, 0.07191416621208191, 0.008162404410541058, 0.01245186768937856, 0.016187091358006, 0.043543798848986626, -0.009479915082920343, 0.023197953589260578, -0.0128170030657202, 0.009029299020767212, 0.04728549160063267, 0.0411943782819435, 0.08705715090036392, 0.034151943400502205, 0.03091753739863634, -0.008500277996063232, -0.037062765564769506, 0.032723722979426384, -0.017894286196678877, -0.057018197141587734, -0.027401311323046684, 0.012518907431513071, 0.0074143747333437204, 0.07037244737148285, -0.0023393332958221436, -0.026991766411811113, -0.03154143411666155, 0.023902101907879114, 0.04603037238121033, 0.028904889710247517, 0.04788004048168659, -0.03380402363836765, 0.04251649044454098, 0.01818377710878849, 0.019481074064970016, 0.028608831577003002, -0.01710190891753882, 0.06451337784528732, 0.014500364544801414, 0.03574225027114153, -0.009639779105782509, -0.010775335133075714, -0.029825964476913214, -0.042237892746925354, 0.10034146532416344, 0.008079767460003495, -0.040079131722450256, 0.016421714331954718, -0.01444422930944711, 0.02031274000182748, 0.018914726562798023, 0.03335639089345932, 0.03541796840727329, -0.026653863489627838, -0.05221548117697239, 0.0063943685963749886, 0.004057109355926514, -0.09564470499753952, -0.04464067239314318, 0.031108970753848553, -0.037283712066709995, 0.02475119661539793, 0.11459792405366898, -0.030784870497882366, 0.020760945044457912, -0.01785914588253945, 0.08094337955117226, -0.015164955519139767, 0.012228903360664845, -0.017235606908798218, 0.08861563354730606, 0.0318350438028574, 0.0757767278701067, 0.012023263610899448, 0.023429375141859055, -0.03745843097567558, -0.04380873590707779, 0.02110994514077902, -0.011707475874572992, -0.012666282244026661, 0.011557577410712838, 0.00443102465942502, 0.04940926283597946, 0.02705614548176527, -0.07491707801818848, 0.02314113173633814, 0.026312096510082483, 0.053126584738492966, -0.045514119789004326, 0.009663000470027328, -0.03952785115689039, 0.04658995568752289, -0.01493800338357687, -0.02509928948711604, -0.003964853240177035, 0.02257065661251545, 0.06703811883926392, 0.03483511647209525, 0.02274334290996194, -0.011276207689661533, 0.07870975881814957, 0.01009555347263813, -0.04503127373754978, 0.07256312668323517, 0.04005438182502985, 0.04977371543645859, -0.0026922628458123654, -0.021050990326330066, 0.01495779538527131, -0.016562148462980986, -0.10143782570958138, 0.0155231868266128, 0.02694749552756548, 0.025097977370023727, 0.04987946338951588, 0.028022659942507744, -0.0011907760053873062, -0.008212624379666522, 0.0758606307208538, -0.005179599393159151, -0.0030273914453573525, -0.01775809336686507, 0.004963372048223391, -0.009773904923349619, 0.03300181636586785, 0.027392339194193482, -0.053647356107831, 0.03208416048437357, -0.016623362724203616, 0.006149550434201956, -0.00938198622316122, -0.056504782289266586, 0.04392931330949068, -0.03535517957061529, 0.0209489983972162, -0.021146904677152634, -0.04691057652235031, 0.031407713890075684, 0.024042493547312915, -0.006175361457280815, 0.06390469148755074, -0.01651687320554629, -0.06339511834084988, 0.03842451050877571, -0.010026296833530068, 0.03832768090069294, -0.0033739758655428886, 0.010911932215094566, -0.045065611600875854, -0.04082046262919903, -0.03455240838229656, -0.027021873276680708, 0.001478658989071846, -0.00935175891208928, 0.015908190980553627, 0.00706840306520462, 0.04809266608208418, 0.01588955894112587, 0.03732101246714592, 0.1253678873181343, -0.10226911678910255, -0.059381358325481415, -0.04539157636463642, -0.004333771765232086, 0.041247001849114895, -0.01853740680962801, -0.008625599090009928, -0.05763876996934414, 0.03215595334768295, 0.03235688805580139, -0.029090310912579298, -0.0585331916809082, 0.042513283900916576, -0.026253306306898594, 0.014785181963816285, 0.031166178174316883, -0.04569920711219311, 0.00002067210152745247, -0.07499086484313011, -0.09185703098773956, 0.003109435550868511, 0.01707480871118605, -0.027403407730162144, -0.0026809941045939922, 0.09174108132719994, -0.010645768605172634, 0.03649126552045345, -0.04568006843328476, 0.0625828392803669, -0.02830026112496853, 0.02947078086435795, -0.017915842588990927, 0.02012275392189622, 0.03067866084165871, 0.061746515333652496, -0.04680593032389879, -0.031035718508064747, -0.008485409547574818, -0.07368514314293861}} ignored := Embeddings{Embedding{-0.00067741907, -0.0473858, -0.055704225, 0.066581585, 0.005290037, 0.03822874, -0.05082791, 0.049087, 0.018308854, -0.01478969, -0.0017964382, 0.057903986, -0.02245441, -0.033446193, -0.0071987803, -0.03150515, 0.017724376, 0.019948162, 0.056362633, -0.11701946, -0.09725581, 0.013104323, 0.07357148, -0.020104313, -0.014956488, -0.017257847, -0.020743687, -0.046340823, -0.021527996, 0.057039287, -0.051751148, -0.00595411, 0.011733857, -0.04644382, -0.028774152, 0.038308877, -0.015685631, 0.0038190065, -0.094677314, 0.07005245, -0.003068884, 0.050274804, -0.018143218, 0.012056174, 0.019058047, -0.00077958487, 0.030408988, 0.0885491, -0.11106459, -0.019910613, 0.01465938, 0.032499526, 0.04720623, 0.03163276, -0.079508044, 0.07914293, 0.03724754, 0.05636608, -0.016979787, -0.04298359, -0.03599786, 0.058342796, -0.024069536, -0.03200436, 0.015390179, 0.07293075, -0.0013783299, -0.01605161, -0.0045498423, -0.016551308, 0.060823392, 0.073548146, -0.021239666, -0.036749583, 0.00028047478, -0.025989566, -0.05310693, -0.009845653, -0.012862101, 0.058108855, 0.06915682, 0.021099294, 0.001225616, 0.033261415, 0.042154703, 0.05271609, -0.030613305, 0.041209485, 0.0019353209, -0.0019135632, 0.080911145, 0.011060149, 0.05281461, -0.10160427, 0.053647887, 0.01762615, -0.018661015, 0.02777136, -0.056023918, 0.057687696, 0.06513923, -0.069180146, -0.015231091, 0.03774808, 0.012945786, 0.090585396, 0.019942591, -0.015280875, -0.0011742035, -0.042135417, 0.05812486, 0.05519544, -0.06453465, -0.04014237, -0.03199121, 0.009241696, 0.043912023, 0.015467731, 0.0020673021, 0.08763925, -0.08974939, -0.05304043, 0.016309343, -0.04766073, -0.0046682972, -0.040477246, 0.012679025, 0.005960806, -0.03256039, -0.07089416, -0.02648642, -0.062463485, 0.08295411, -0.037147924, -0.074104264, 0.077417135, -0.042383663, 0.002088579, 0.07709948, 0.06521331, -0.07541816, 0.057679284, -0.0038482754, 0.055191133, 0.058614884, -0.018541405, -0.012277692, 0.057926673, -0.01724738, 0.020869015, 0.046103075, -0.0319926, -0.0671411, 0.02629761, 0.044356663, 0.036788594, 0.028035736, 0.06419986, 0.045972086, -0.044160895, 0.09784713, 0.00953585, -0.06252615, 0.025597766, 0.029688764, 0.027506752, -0.055384982, -0.028262418, -0.057812758, 0.042470966, -0.05840525, -0.03801629, 0.0043816785, -0.015086851, 0.022297874, 0.054110903, 0.07420415, -0.040949743, -0.08912868, -0.060081407, -0.046966024, -0.04826231, -0.031198893, 0.06643161, 0.01347482, 0.029003717, 0.047974125, 0.07580259, 0.0364837, 0.012980756, 0.020622224, -0.022555852, 0.10519882, -0.03425076, 0.03889103, -0.007944982, 0.060116176, 0.038143042, -0.043681793, 0.05316621, 0.0016697546, -0.0033659195, 0.020053076, -0.07204762, 0.009732797, 0.03862544, 0.03913928, -0.009832126, 0.06401315, 0.044209804, -0.051490918, 0.014780334, -0.025438532, -0.01395564, -0.038089562, -0.009803314, -0.04146325, 0.03357636, -0.009009651, 0.04373462, -0.05627207, -0.072068065, -0.007331119, -0.04238925, -0.021102922, -0.021610938, -0.063095644, -0.05075978, -0.07491732, 0.0113026835, 0.04940704, 0.084163934, -0.01636119, -0.06292533, -0.014526007, -0.007826649, 0.07212185, 0.004734863, -0.062791124, -0.016170232, -0.016590146, -0.024280416, -0.019522576, 0.01579864, 0.002749153, 0.053687476, -0.016495354, 0.03662209, -0.018870195, 0.039446633, 0.04715818, 0.013310755, 0.028033575, 0.067203104, -0.005826697, 0.042239364, -0.020745477, 0.0015561507, 0.065384425, 0.09041862, 0.01788624, -0.010026493, 0.0639752, -0.0041079777, -0.058741663, 0.034099422, 0.016963305, -0.0052649197, -0.07403116, -0.0029912698, -0.07583906, 0.001012409, -0.029492352, -0.04166984, -0.048218843, -0.06306306, -0.0033243645, -0.02919451, 0.0039520795, -0.037993237, 0.044352133, 0.03976749, -0.030565975, -0.076377496, -0.06569797, 0.01630497, 0.017201763, 0.028935125, 0.004058029, -0.09946857, 0.036038112, -0.06792709, 0.04493338, 0.035801385, -0.048764315, -0.06326099, 0.037968885, 0.038012274, 0.038041856, 0.04288072, 0.01531972, 0.032477308, 0.043926656, -0.0077148937, 0.056322563, -0.03451439, -0.0083661955, 0.0015379508, -0.007879496, 0.01986026, -0.019533899, 0.0405012, 0.015047856, 0.04601962, 0.080275685, 0.017424034, -0.032671392, 0.024088044, -0.021807125, 0.010775311, 0.094901696, 0.0048406925, 0.013086048, 0.04339756, -0.0069915624, 0.019183818, 0.0624931, 0.019509323, 0.07727781, 0.071851335, 0.046544127, 0.040363774, -0.027118236, 0.06800823, -0.01851149, 0.039025713, -0.037301723, 0.05617681, 0.027737545, -0.0011841523, 0.034742635, 0.006083848, 0.033872508, 0.012025738, -0.02354928, -0.07461171, 0.0027702893, 0.04646551, 0.06590462, -0.00794524, -0.011096932, 0.031695057, -0.06732352, -0.051879242, -0.0773121, -0.000517982, 0.08113213, -0.015312499, 0.018544769, -0.023654874, -0.01689197, 0.026425209, -0.08191027, 0.03139842, -0.011997609, 0.059896134, 0.07505033, -0.012907369, 0.008597082, 0.007715897, -0.07062183, -0.027084265, 0.0028182073, 0.03769887, 0.034299187, 0.046780333, -0.007847023, -0.051446356, 0.007982996, -0.034917314, -0.0038174198, -0.05954771, -0.044208106, 0.04685703, -0.0199229, -0.0032713648, 0.009684984, -0.050678924, 0.007356914, -0.06628045, 0.042982273, 0.0055478252, 0.011330174, -0.082057334, 0.026437566, -0.015942575, 0.048285805, -0.003856138, 0.04399534, 0.01741405, -0.059217025, 0.056499016, -0.03459506, 0.030366927, 0.016147505, -0.021027595, -0.013333387, -0.035330992, 0.0445699, -0.03483558, 0.02072434, -0.019552084, -0.0043943045, -0.03957101, 0.0041682394, 0.006047565, 0.03504845, 0.04675005, -0.021805461, -0.0033183587, -0.0017508261, 0.033419013, 0.008266579, 0.067113, -0.026226636, -0.020189233, 0.029219048, 0.031028047, 0.021648621, -0.055164326, -0.008505359, 0.05173594, 0.016450783, -0.017234024, -0.10492493, -0.04954522, 0.024168914, -0.008840458, -0.078473605, -0.042714797, -0.040692057, -0.05446264, 0.0148880705, 0.057658363, 0.005458192, 0.02171352, -0.04556389, 0.017333247, -0.10342444, -0.06159851, -0.03170678, 0.08064648, 0.024460033, -0.07185376, -0.0019515441, -0.026248276, 0.034460787, 0.08695437, 0.06363327, 0.012909266, 0.00093975884, 0.03682474, -0.041370448, -0.0070990156, 0.058603138, -0.038166087, -0.039693672, 0.025385896, 0.0035452761, -0.015794974, 0.019059189, -0.028707229, 0.038948998, -0.032039847, -0.07992934, -0.05482927, 0.048767164, -0.03186542, 0.059099294, 0.063702375, 0.01810526, -0.019284561, 0.036313917, 0.0006970895, 0.020730797, 0.08630282, -0.10650717, 0.0017196184, 0.023258938, -0.021214833, 0.015206377, -0.027243242, -0.021319263, -0.054438062, 0.066603355, -0.047786396, 0.018822387, -0.031346995, -0.0049103773, -0.020732613, -0.0841506, 0.00707288, -0.0033278253, 0.068160556, -0.011127404, 0.05533654, 0.0046188673, 0.039132893, 0.008633137, -0.057081457, -0.030337824, -0.0721918}} both := Embeddings{regular[0], ignored[0]} diff --git a/internal/config/config.go b/internal/config/config.go index 0a1a08911..75af61037 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -364,8 +364,8 @@ func (c *Config) Propagate() { face.ClusterRadius = c.FaceClusterRadius() face.ClusterDist = c.FaceClusterDist() face.MatchDist = c.FaceMatchDist() - face.SkipChildren = !c.FaceMatchChildren() - face.IgnoreBackground = !c.FaceMatchBackground() + face.SkipChildren = c.FaceSkipChildren() + face.IgnoreBackground = !c.FaceAllowBackground() face.DetectionAngles = c.FaceAngles() if err := face.ConfigureEngine(face.EngineSettings{ Name: c.FaceEngine(), diff --git a/internal/config/config_faces.go b/internal/config/config_faces.go index dff5f0b66..ee0d8c7ad 100644 --- a/internal/config/config_faces.go +++ b/internal/config/config_faces.go @@ -260,22 +260,22 @@ func (c *Config) FaceMatchDist() float64 { return c.options.FaceMatchDist } -// FaceMatchChildren reports whether child embeddings should be matched automatically. -func (c *Config) FaceMatchChildren() bool { +// FaceSkipChildren reports whether child embeddings should be skipped when matching. +func (c *Config) FaceSkipChildren() bool { if c == nil { - return false + return face.SkipChildren } - return c.options.FaceMatchChildren + return c.options.FaceSkipChildren } -// FaceMatchBackground reports whether background embeddings should be matched. -func (c *Config) FaceMatchBackground() bool { +// FaceAllowBackground reports whether background embeddings should not be ignored. +func (c *Config) FaceAllowBackground() bool { if c == nil { - return false + return !face.IgnoreBackground } - return c.options.FaceMatchBackground + return c.options.FaceAllowBackground } // FaceAngles returns the set of detection angles in radians. diff --git a/internal/config/config_faces_test.go b/internal/config/config_faces_test.go index ddf71f50b..1d5937dd0 100644 --- a/internal/config/config_faces_test.go +++ b/internal/config/config_faces_test.go @@ -288,18 +288,18 @@ func TestConfig_FaceMatchDist(t *testing.T) { assert.Equal(t, face.MatchDist, c.FaceMatchDist()) } -func TestConfig_FaceMatchChildren(t *testing.T) { +func TestConfig_FaceSkipChildren(t *testing.T) { c := NewConfig(CliTestContext()) - assert.False(t, c.FaceMatchChildren()) - c.options.FaceMatchChildren = true - assert.True(t, c.FaceMatchChildren()) + assert.False(t, c.FaceSkipChildren()) + c.options.FaceSkipChildren = true + assert.True(t, c.FaceSkipChildren()) } -func TestConfig_FaceMatchBackground(t *testing.T) { +func TestConfig_FaceAllowBackground(t *testing.T) { c := NewConfig(CliTestContext()) - assert.False(t, c.FaceMatchBackground()) - c.options.FaceMatchBackground = true - assert.True(t, c.FaceMatchBackground()) + assert.False(t, c.FaceAllowBackground()) + c.options.FaceAllowBackground = true + assert.True(t, c.FaceAllowBackground()) } func TestConfig_FaceAngles(t *testing.T) { diff --git a/internal/config/flags.go b/internal/config/flags.go index 9ced9d769..61b099529 100644 --- a/internal/config/flags.go +++ b/internal/config/flags.go @@ -1252,14 +1252,14 @@ var Flags = CliFlags{ EnvVars: EnvVars("FACE_MATCH_DIST"), }}, { Flag: &cli.BoolFlag{ - Name: "face-match-children", - Usage: "enable automatic matching for child face embeddings", - EnvVars: EnvVars("FACE_MATCH_CHILDREN"), + Name: "face-skip-children", + Usage: "skips automatic matching of child face embeddings", + EnvVars: EnvVars("FACE_SKIP_CHILDREN"), }}, { Flag: &cli.BoolFlag{ - Name: "face-match-background", - Usage: "enable automatic matching for background embeddings", - EnvVars: EnvVars("FACE_MATCH_BACKGROUND"), + Name: "face-allow-background", + Usage: "allows matching of probable background embeddings", + EnvVars: EnvVars("FACE_ALLOW_BACKGROUND"), }}, { Flag: &cli.StringFlag{ Name: "pid-filename", diff --git a/internal/config/options.go b/internal/config/options.go index 46116293c..b3548e9b5 100644 --- a/internal/config/options.go +++ b/internal/config/options.go @@ -246,8 +246,8 @@ type Options struct { FaceCollisionDist float64 `yaml:"-" json:"-" flag:"face-collision-dist"` FaceEpsilonDist float64 `yaml:"-" json:"-" flag:"face-epsilon-dist"` FaceMatchDist float64 `yaml:"-" json:"-" flag:"face-match-dist"` - FaceMatchChildren bool `yaml:"-" json:"-" flag:"face-match-children"` - FaceMatchBackground bool `yaml:"-" json:"-" flag:"face-match-background"` + FaceSkipChildren bool `yaml:"-" json:"-" flag:"face-skip-children"` + FaceAllowBackground bool `yaml:"-" json:"-" flag:"face-allow-background"` PIDFilename string `yaml:"PIDFilename" json:"-" flag:"pid-filename"` LogFilename string `yaml:"LogFilename" json:"-" flag:"log-filename"` DetachServer bool `yaml:"DetachServer" json:"-" flag:"detach-server"` diff --git a/internal/config/report.go b/internal/config/report.go index a746d1556..a8cc26e2c 100644 --- a/internal/config/report.go +++ b/internal/config/report.go @@ -327,8 +327,8 @@ func (c *Config) Report() (rows [][]string, cols []string) { {"face-collision-dist", fmt.Sprintf("%f", c.FaceCollisionDist())}, {"face-epsilon-dist", fmt.Sprintf("%f", c.FaceEpsilonDist())}, {"face-match-dist", fmt.Sprintf("%f", c.FaceMatchDist())}, - {"face-match-children", fmt.Sprintf("%t", c.FaceMatchChildren())}, - {"face-match-background", fmt.Sprintf("%t", c.FaceMatchBackground())}, + {"face-skip-children", fmt.Sprintf("%t", c.FaceSkipChildren())}, + {"face-allow-background", fmt.Sprintf("%t", c.FaceAllowBackground())}, // Daemon Mode. {"pid-filename", c.PIDFilename()}, diff --git a/internal/photoprism/faces_match_test.go b/internal/photoprism/faces_match_test.go index 4d0a2aa95..311869976 100644 --- a/internal/photoprism/faces_match_test.go +++ b/internal/photoprism/faces_match_test.go @@ -35,10 +35,10 @@ func TestBuildFaceCandidates(t *testing.T) { regular := entity.NewFace("", entity.SrcAuto, face.RandomEmbeddings(3, face.RegularFace)) require.NotNil(t, regular) - children := entity.NewFace("", entity.SrcAuto, face.RandomEmbeddings(3, face.ChildrenFace)) - require.NotNil(t, children) + background := entity.NewFace("", entity.SrcAuto, face.RandomEmbeddings(3, face.BackgroundFace)) + require.NotNil(t, background) - faces := entity.Faces{*regular, *children} + faces := entity.Faces{*regular, *background} index := buildFaceIndex(faces)