photoprism/internal/face/embeddings_kids.go

41 lines
23 KiB
Go
Raw Normal View History

package face
import (
"os"
"strconv"
)
// KidsDist is the distance threshold for matching KidsEmbeddings.
var KidsDist = 0.695
func init() {
if s := os.Getenv("PHOTOPRISM_FACE_KIDS_DIST"); s == "" {
// Keep default.
} else if f, err := strconv.ParseFloat(s, 32); err != nil {
log.Warnf("faces: PHOTOPRISM_FACE_KIDS_DIST can not be parsed (0.1-1.5; -1 to disable)")
} else if f < 0 {
KidsDist = -1
log.Debugf("faces: enabled matching of all kids embeddings")
} else if f >= 0.1 && f <= 1.5 {
KidsDist = f
log.Debugf("faces: changed matching distance for kids embeddings to %f", KidsDist)
} else {
log.Warnf("faces: PHOTOPRISM_FACE_KIDS_DIST is out of range (0.1-1.5; -1 to disable)")
}
}
// KidsFace tests if the embedded face belongs to a baby or young child.
func (m Embedding) KidsFace() bool {
if KidsDist <= 0 {
return false
}
return KidsEmbeddings.Contains(m, KidsDist)
}
// KidsEmbeddings contains embeddings of children's faces that are (currently) too generic to be properly matched.
var KidsEmbeddings = Embeddings{
{0.014076345932802983, 0.00010343994862133903, -0.010959638582010354, 0.04127759233649288, 0.08789882808923721, 0.017725093897232518, -0.022899451665580273, 0.0452611151018313, 0.03823948075296357, 0.06343058230621475, 0.04759708313005311, 0.025469324551522732, -0.038468056092304845, -0.01729393713841481, -0.024367967886584147, -0.013041795021438572, -0.023096864776951925, 0.02793885980333601, -0.01649821868964604, 0.01995509217626282, -0.01322871370108, -0.008252202965585249, 0.028910591408410773, -0.07333579286932945, -0.08700574721608843, 0.07423889530556542, 0.07409120404294559, -0.008282799340252365, -0.045015843851225715, 0.03404966489012752, 0.01429881900548935, -0.016775283297257765, -0.010920435023893203, 0.050287961161562374, -0.001957439451611468, -0.021051756106317043, -0.024205328364457403, 0.003975618431078536, -0.07230451224105698, 0.03437736251258424, -0.026977801843064038, -0.0028144880530557464, 0.0007902844808995724, 0.06425002217292786, 0.0022268929917897496, 0.001021586192239608, -0.004946612969173917, 0.04372643147196088, -0.08558774952377592, -0.04968303974185671, 0.002605055658412831, -0.03057751152664423, 0.04062951808529241, 0.02759489676515971, -0.07084034436515399, 0.01893762020128114, -0.025910851021762937, 0.0092267398223547, -0.051628660942826955, 0.007369522271411759, -0.008836706734395452, -0.006196810797389064, -0.025300242139824798, 0.011610688575144325, -0.03033792200897421, -0.03983142187020609, -0.0495086024914469, -0.049739364734185595, 0.018020538247323463, -0.002467086366648021, 0.01068531721830368, -0.012969749713582652, -0.005401422668780599, -0.07798752295119422, -0.015362580107258899, 0.023464103628482138, -0.03776164698813643, -0.037554266463432996, 0.020393860027460114, -0.0013615138117789424, 0.03326471469232014, 0.025772061997226307, 0.03849751901413713, -0.009273543953895569, -0.020172682125121355, 0.07898283536945071, -0.020976615803582326, 0.013514869646834475, 0.034119718575051854, 0.011594483063423209, -0.05110570602118969, -0.0017224330721156938, -0.008944391782279126, -0.03416518388049943, 0.07138298824429512, 0.026323047632883703, 0.0073144749206091675, 0.07004635035991669, -0.022454025805927813, -0.040454973599740436, 0.043226572551897595, 0.03743345769388335, 0.0006607548067612308, 0.11384290669645582, 0.04992901560451303, 0.005408631754107773, 0.009607095537441117, -0.012680422797399973, 0.024073518147425994, -0.04440920746752194, 0.004120621896748032, 0.02761713575039591, -0.04635274117546422, -0.06435357247080122, 0.031128881632217338, 0.016416337208024094, -0.008968281027461802, 0.04653826622026307, 0.025854617889438356, 0.012687867827480659, 0.028297867892043933, -0.0342022893684251, -0.019416423381439278, -0.05280240252614021, -0.03576486740660455, -0.10419229524476188, -0.0395921202642577, -0.002911932795541361, -0.01974446409648018, -0.038143089307206016, -0.03505285644834138, 0.03834166377782822, 0.05046930696283068, -0.03904489088537438, 0.0015146988932558867, 0.0006450490493859563, -0.01604000066540071, -0.060584313103130887, -0.0234440263759877, 0.1150767132639885, 0.04494018480181694, 0.04640173725783825, -0.0817852717425142, 0.06888745352625847, -0.013860651824091162, -0.030807798728346825, 0.031202219160539762, 0.061024581747395654, -0.04371023550629616, 0.04711497601653848, 0.009631564042397909, 0.034288076018648486, -0.0194188054717545, 0.05254533940127918, -0.01510106319827693, 0.009491389650585396, -0.05281628668308258, 0.02491598323519741, -0.005189976239177797, -0.08681996273142951, 0.06076004409364292, 0.07559112406202725, -0.05669804077063288, 0.02945604913734964, 0.027437320245163783, 0.015105903082128082, -0.04193821709070887, -0.026287166617943773, -0.0038107597585102277, 0.06687954121402331, 0.03067953691684774, -0.009460966102778912, -0.04888412994997842, 0.04546929177428995, 0.04723436451916184, 0.05976005271077156, -0.061716834881475995, -0.04373723414859602, -0.03389950868274484, -0.02664987860979246, -0.03256083915143141, 0.06557192546980721, -0.0290171406897051, 0.027153336176914827, 0.056861317051308494, 0.00020447039111916508,
{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.022
}