face_recognition icon indicating copy to clipboard operation
face_recognition copied to clipboard

Running an efficient query against MySQL

Open avifatal opened this issue 3 years ago • 0 comments

  • face_recognition version: latest
  • Python version: 3.8
  • Operating System: ubuntu

Description

Im trying to run the query bellow in MySQL to get the most relevant pictures. I put limit 50 The first X results accurate - same person, but I don't understand how to remove the other not relevant results

0.0000021870120566841554
0.0000021870120566841554
0.0000021870120566841554
0.0000021870120566841554
0.08143775782396924
0.09950683355969232
0.09950683355969232
0.12564347437111337
0.12564347437111337
0.20908395211481443
0.20908395211481443
0.4356908851715821
0.4356908851715821
0.43587200277058663
0.43587200277058663
0.43587200277058663
0.43587200277058663
0.43587200277058663
0.43587200277058663
0.43587200277058663
0.43587200277058663
0.436500480563443
0.436500480563443
0.5443266775624251 // The unrelevant results are from here and on
0.5754427188009463
0.5754427188009463
0.5756499541994318
0.5767144568199682
0.5786536560726395
0.5822444540375636
0.5827908287716425
0.5882543368088854
0.5889837891121266
0.5898137138101495
0.5899860753098493
0.5915487909260737
0.5931386127900719

The qeury

select id,
       sqrt(
            power(f1 - -0.0843882, 2) + power(f2 - 0.137928, 2) + power(f3 - 0.0213506, 2) + power(f4 - -0.0461729, 2) +
           ............... + power(f128 - 0.0514276, 2)
       ) as distance
from index_entity person
ORDER BY distance
limit 50

How can I detect when its not the same person? Thanks

avifatal avatar Dec 15 '21 12:12 avifatal