photoprism/internal/entity/markers_test.go

198 lines
27 KiB
Go
Raw Normal View History

package entity
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/photoprism/photoprism/internal/crop"
"github.com/photoprism/photoprism/internal/face"
)
var cropArea1 = crop.Area{Name: "face", X: 0.308333, Y: 0.206944, W: 0.355556, H: 0.355556}
2021-09-20 22:19:54 +02:00
var cropArea2 = crop.Area{Name: "face", X: 0.208313, Y: 0.156914, W: 0.655556, H: 0.655556}
var cropArea3 = crop.Area{Name: "face", X: 0.998133, Y: 0.816944, W: 0.0001, H: 0.0001}
var cropArea4 = crop.Area{Name: "face", X: 0.298133, Y: 0.216944, W: 0.255556, H: 0.155556}
var testEmbeddings = face.Embeddings{
face.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.110138
face.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.00787949
face.Embedding{0.05743743, 0.06322246, 0.04731233, -0.01582013, -0.014022472, 0.028749773, -0.079572044, 0.010417165, 0.012425559, -0.013655686, -0.05018789, 0.026249807, 0.037449032, 0.051438555, -0.055292394, 0.018136416, 0.035481997, 0.021924775, 0.0449153, -0.046709806, 0.025960712, -0.063309774, 0.037570722, 0.0053055496, 0.07164356, -0.058082405, 0.0017537506, 0.05310737, 0.008366767, 0.001858572, -0.0444527, -0.04880738, -0.033274952, -0.08379612, -0.018964237, -0.0029277618, -0.021386296, 0.0375952, -0.034034044, -0.060141306, -0.0727236, 0.05060482, -0.082235344, 0.04422095, 0.074947104, 0.020209799, 0.0017703519, -0.015411033, 0.012017898, 0.02179871, -0.013231191, -0.08483583, 0.0057485234, -0.019012775, -0.04857383, 0.084329374, 0.009039854, 0.040807534, -0.01692938, 0.0017201875, 0.036594935, -0.08844029, -0.00285713, 0.054565318, -0.047155175, 0.017556412, 0.009818504, 0.113506615, -0.009222306, -0.0004704829, -0.0005908021, 0.023356704, 0.015126567, 0.035651624, 0.025497274, -0.10676789, -0.06828348, 0.112095155, 0.08150907, 0.0007053766, -0.008199173, -0.03852071, 0.029535439, -0.030568745, -0.08978221, -0.004848515, -0.03737906, 0.036448833, 0.004548617, 0.08181337, -0.0087715015, 0.02876368, -0.0060202847, -0.013462866, -0.05015226, -0.03569624, 0.049505115, 0.011994855, -0.010969182, -0.0038046215, -0.004821639, 0.01422656, -0.05946822, -0.013812223, 0.039755587, 0.034921456, -0.05158028, -0.0008751564, -0.031674784, -0.002480392, 0.013109971, -0.017252844, 0.064675435, 0.07642624, 0.08362122, 0.030908048, 0.067052245, 0.021291262, 0.01784629, -0.0507172, 0.052007917, 0.04663132, 0.0064223176, -0.027726524, 0.08033194, 0.038676508, 0.018382965, 0.048913725, -0.022436062, 0.0056725373, -0.040102404, 0.037674494, -0.022307452, -0.03098931, 0.0577183, -0.022725038, -0.0055031423, 0.045162845, -0.014300147, -0.018093627, -0.040114313, -0.051383376, -0.030573318, -0.101557806, -0.008447289, 0.014637746, 0.050047614, -0.011550598, 0.027773034, -0.03317795, -0.048737925, -0.02800452, -0.016925864, -0.037572905, 0.025179392, 0.031473313, -0.010588548, -0.0119464, 0.0057186596, 0.049826983, -0.026282294, -0.00095309806, 0.04696705, -0.0444816, -0.04687481, -0.05711774, 0.07398202, -0.0066416007, -0.016446855, 0.051111717, -0.0419391, -0.013271554, 0.043318115, 0.0012680996, 0.037176434, -0.021031545, 0.03968714, 0.048614495, -0.0058204047, -0.010237752, 0.07029732, 0.018752169, -0.0616816, 0.008854898, 0.06205655, -0.009874518, -0.050585378, 0.012557405, 0.01626891, 0.017797807, -0.03568621, -0.007182635, 0.015247179, 0.02795279, 0.009831571, 0.045041207, -0.055870973, -0.025731718, 0.01907759, -0.034226514, 0.029678043, -0.021697098, -0.020734878, 0.057307053, -0.008900531, -0.019598745, -0.03082626, 0.014591779, 0.06420119, -0.059627317, -0.03732171, 0.016718497, -0.0027331563, 0.013793794, 0.06873449, 0.031878877, -0.025323479, 0.017207827, -0.00025769856, 0.01302832, -0.033877812, 0.1036087, -0.031368185, -0.0062403507, -0.020410763, 0.064998895, -0.049161144, 0.075556606, -0.005309279, 0.024778325, -0.055955246, -0.053952686, 0.04611469, -0.040877238, 0.0366899, 0.05907716, -0.023292458, -0.081198305, 0.078474045, 0.050623402, -0.06233864, 0.07453958, 0.0152983265, -0.04816594, 0.023196025, -0.03438517, -0.024680838, -0.04664079, 0.054698855, 0.0038191404, 0.0024043208, 0.0034349218, -0.03711057, 0.001107596, -0.0028691792, 0.00030419108, 0.037632354, 0.060571946, -0.0946064, 0.042204216, -0.037838906, 0.021439435, -0.076814726, 0.06236704, 0.012242562, -0.061841127, 0.016115433, -0.063648604, 0.025584254, 0.10527214, -0.079565875, 0.008840051, 0.06655628, -0.0051484755, -0.08278825, -0.023478502, 0.0713399, -0.018204115, 0.048147563, -0.12774643, -0.014040633, 0.052833144, 0.0025820592, 0.029898077, 0.09640923, 0.08246072, 0.02947083, -0.015254255, -0.05879318, -0.08034651, -0.03984985, -0.008921548, 0.0035848247, 0.01210673, 0.01669468, -0.011540037, 0.043646365, 0.12930681, 0.028525097, -0.033249676, 0.009854595, 0.020683004, -0.03317388, 0.030189851, -0.037221596, 0.056988247, 0.028217647, -0.0988498
}
func TestMarkers_Contains(t *testing.T) {
t.Run("Examples", func(t *testing.T) {
m1 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea1, "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 100, 65)
m2 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea2, "lt9k3pw1wowuy1c2", SrcImage, MarkerFace, 100, 65)
m3 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea3, "lt9k3pw1wowuy1c3", SrcImage, MarkerFace, 100, 65)
2021-09-20 22:19:54 +02:00
assert.Equal(t, 29, m1.OverlapPercent(m2))
assert.Equal(t, 100, m2.OverlapPercent(m1))
2021-09-20 22:19:54 +02:00
m := Markers{m2}
assert.True(t, m.Contains(m1))
assert.False(t, m.Contains(m3))
})
t.Run("Conflicting", func(t *testing.T) {
file := File{FileUID: "", FileHash: "cca7c46a4d39e933c30805e546028fe3eab361b5"}
markers := Markers{
*NewMarker(file, crop.Area{Name: "subj-1", X: 0.549479, Y: 0.179688, W: 0.393229, H: 0.294922}, "jqyzmgbquh1msz6o", SrcImage, MarkerFace, 100, 65),
*NewMarker(file, crop.Area{Name: "subj-2", X: 0.0833333, Y: 0.321289, W: 0.476562, H: 0.357422}, "jqyzml91cf2yyfi7", SrcImage, MarkerFace, 100, 65),
}
conflicting := *NewMarker(file, crop.Area{Name: "subj-2", X: 0.190104, Y: 0.40918, W: 0.31901, H: 0.239258}, "jqyzml91cf2yyfi7", SrcImage, MarkerFace, 100, 65)
assert.True(t, markers.Contains(conflicting))
})
t.Run("SameFace", func(t *testing.T) {
file := File{FileHash: "a6c46e43b83fc02309b1c49e1ed7273f1f414610"}
markers := Markers{
*NewMarker(file, crop.Area{Name: "subj-1", X: 0.388021, Y: 0.365234, W: 0.179688, H: 0.134766}, "jqyzmgbquh1msz6o", SrcImage, MarkerFace, 100, 65),
}
conflicting := *NewMarker(file, crop.Area{Name: "subj-1", X: 0.34375, Y: 0.291992, W: 0.266927, H: 0.200195}, "jqyzmgbquh1msz6o", SrcImage, MarkerFace, 100, 65)
assert.True(t, markers.Contains(conflicting))
})
t.Run("NoFace", func(t *testing.T) {
file := File{FileUID: "fqzuh672i9btq6gu", FileHash: "243cdbe99b865607f98a951e748d528bc22f3143"}
markers := Markers{
*NewMarker(file, crop.Area{Name: "no-face", X: 0.322656, Y: 0.3, W: 0.180469, H: 0.240625}, "jqyzmgbquh1msz6o", SrcImage, MarkerFace, 100, 65),
}
conflicting := *NewMarker(file, crop.Area{Name: "face", X: 0.325, Y: 0.0510417, W: 0.136719, H: 0.182292}, "jqyzmgbquh1msz6o", SrcImage, MarkerFace, 100, 65)
assert.False(t, markers.Contains(conflicting))
})
}
2021-09-23 23:46:17 +02:00
func TestMarkers_DetectedFaceCount(t *testing.T) {
m1 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea1, "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 100, 65)
2021-09-23 23:46:17 +02:00
m2 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea4, "lt9k3pw1wowuy1c2", SrcManual, MarkerFace, 100, 65)
m3 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea3, "lt9k3pw1wowuy1c3", SrcManual, MarkerFace, 100, 65)
m3.MarkerInvalid = true
m := Markers{m1, m2, m3}
2021-09-23 23:46:17 +02:00
assert.Equal(t, 1, m.DetectedFaceCount())
}
func TestMarkers_ValidFaceCount(t *testing.T) {
m1 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea1, "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 100, 65)
m2 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea4, "lt9k3pw1wowuy1c2", SrcManual, MarkerFace, 100, 65)
m3 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea3, "lt9k3pw1wowuy1c3", SrcManual, MarkerFace, 100, 65)
m3.MarkerInvalid = true
m := Markers{m1, m2, m3}
assert.Equal(t, 2, m.ValidFaceCount())
}
func TestMarkers_SubjectNames(t *testing.T) {
m1 := MarkerFixtures.Get("1000003-3")
m2 := MarkerFixtures.Get("1000003-4")
m3 := MarkerFixtures.Get("1000003-5")
m1.MarkerInvalid = true
m := Markers{m1, m2, m3}
assert.Equal(t, []string{"Jens Mander", "Corn McCornface"}, m.SubjectNames())
}
2021-09-23 23:46:17 +02:00
func TestMarkers_Labels(t *testing.T) {
t.Run("None", func(t *testing.T) {
m := Markers{}
result := m.Labels()
if len(result) > 0 {
t.Fatalf("unexpected result: %#v", result)
}
})
t.Run("One", func(t *testing.T) {
m1 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea1, "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 100, 12)
m2 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea4, "lt9k3pw1wowuy1c2", SrcImage, MarkerFace, 100, 300)
m2.MarkerInvalid = true
m := Markers{m1, m2}
result := m.Labels()
if len(result) == 1 {
t.Logf("labels: %#v", result)
assert.Equal(t, "portrait", result[0].Name)
assert.Equal(t, SrcImage, result[0].Source)
assert.Equal(t, 45, result[0].Uncertainty)
assert.Equal(t, 0, result[0].Priority)
assert.Len(t, result[0].Categories, 1)
if len(result[0].Categories) == 1 {
assert.Equal(t, "people", result[0].Categories[0])
}
} else {
t.Fatalf("unexpected result: %#v", result)
}
})
t.Run("Many", func(t *testing.T) {
m1 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea1, "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 100, 65)
m2 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea4, "lt9k3pw1wowuy1c2", SrcImage, MarkerFace, 100, 65)
m3 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea3, "lt9k3pw1wowuy1c3", SrcImage, MarkerFace, 100, 65)
m3.MarkerInvalid = true
m := Markers{m1, m2, m3}
result := m.Labels()
if len(result) == 1 {
t.Logf("labels: %#v", result)
assert.Equal(t, "people", result[0].Name)
assert.Equal(t, SrcImage, result[0].Source)
assert.Equal(t, 25, result[0].Uncertainty)
assert.Equal(t, 0, result[0].Priority)
assert.Len(t, result[0].Categories, 0)
} else {
t.Fatalf("unexpected result: %#v", result)
}
})
}
func TestMarkers_AppendWithEmbedding(t *testing.T) {
t.Run("Success", func(t *testing.T) {
m1 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea1, "lt9k3pw1wowuy1c1", SrcImage, MarkerFace, 100, 65)
m2 := *NewMarker(FileFixtures.Get("exampleFileName.jpg"), cropArea3, "lt9k3pw1wowuy1c3", SrcImage, MarkerFace, 100, 65)
m := Markers{m1}
m.AppendWithEmbedding(m2)
assert.Len(t, m, 1)
assert.True(t, m.Contains(m1))
assert.True(t, m.Contains(m1))
assert.False(t, m.Contains(m2))
m2.SetEmbeddings(face.Embeddings{testEmbeddings[0], testEmbeddings[2]})
assert.Len(t, m, 1)
m.AppendWithEmbedding(m2)
assert.Len(t, m, 1)
assert.True(t, m.Contains(m1))
assert.False(t, m.Contains(m2))
m2.SetEmbeddings(face.Embeddings{testEmbeddings[0]})
m.AppendWithEmbedding(m2)
assert.Len(t, m, 2)
assert.True(t, m.Contains(m1))
assert.True(t, m.Contains(m2))
})
}