23

There seem to be good GUI tools to enable facial recognition with FLOSS, they all fall short of my requirements. And while there seem to be a lot of research projects with open code, they seem to be lacking in the "usable in real life" department.

It seems as if there should be something to scratch that itch, but I couldn't find it.

Thus, my wishlist for facial recognition software

  • MUST NOT send any data to any third parties!
  • Must run on Linux
  • GUI and CLI are both fine as long as the rest of the specs are met, but good CLI-integration would be a huge plus
  • Should offer batch-verification of detected faces like so
  • Must not rely on duplicating files in its own data structure/DB/directory; symlinks are fine
  • Should cope with source files disappearing
  • Should be able to list/diff files which are new or not yet tagged
  • Must not require being able to write to any picture files
  • Must be able to store data outside of the original pictures
  • Should not modify the source directories without being told to; temp files, face DB, and similar should all be located in a place I decide upon
  • Should offer batch-processing
  • Must be able to trigger a command or script for all verified identifications i.e. the ones I manually set to matching the person; alternatively, at least be able to export data in a way I can build scripts upon
  • Should be able to cope with faces changing over time, people growing older, getting a beard, etc
  • Should be FLOSS if at all possible
  • I consider tags to be permanent, the DB for the program should ideally be ephemeral but I am aware that this may not be possible
  • If the DB needs to be retained, it should ideally be in a merge-friendly text format not binary but that may be asking too much.

This is a verbatim copy1 of http://richardhartmann.de/blog/posts/2014/03/03-Facial_recognition/ - while I didn't get any actual replies to my question, I have been pointed here as the most likely place for finding the answers I need.


1 Actually, I lie. I need at least 10 magic brownie points to post more than two links at once.

1

2 Answers 2

4

Luxand

Multiple products but the SDK is almost certainly what you want. Runs on multiple platforms, including Linux. The list of features is even longer than your wishlist.

You wrote, however, "Should be FLOSS if at all possible." The product(s) that meet your requirements are not gratis. Furthermore, I could not find anything that indicated it was open source.

I am not associated with the product or company in any way.

0

face_recognition tool from the face_recognition Python package

https://github.com/ageitgey/face_recognition

Install on Ubuntu 24.04:

sudo apt install imagemagick
virtualenv -p python3 .venv
. .venv/bin/activate
pip install \
  face-recognition==1.3.0 \
  git+https://github.com/ageitgey/face_recognition_models@e67de717267507d1e9246de95692eb8be736ab61 \
  setuptools==72.2.0

Then you can check if running:

face_detection myimg.jpg

produces any output or not. If it doesn't, there are no faces, so:

if [ -n "$(face_detection myimg.jpg)" ]; then
  echo hasface
else
  echo noface
fi

Face recognition: face_recognition tool from the face_recognition Python package

Answering the question title rather than the question body. Their API is kind of cute. You make:

  • one directory known/ with known face labels
  • and one directory unknown/ to search for those faces in

and then just:

face_recognition known unknown

Example:

known

mkdir -p known
wget -O known/obama.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/615px-President_Barack_Obama.jpg
wget -O known/trump.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/5/56/Donald_Trump_official_portrait.jpg/606px-Donald_Trump_official_portrait.jpg

unknown

mkdir -p unknown
wget -O unknown/obama-biden.jpg https://upload.wikimedia.org/wikipedia/commons/8/80/Official_portrait_of_President_Obama_and_Vice_President_Biden_2009.jpg
wget -O unknown/trump-pence.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/f/f0/Trump_on_China_-_Putting_America_First_%28November_2%2C_2020%29%2C_front_cover_%28cropped%29.png/1024px-Trump_on_China_-_Putting_America_First_%28November_2%2C_2020%29%2C_front_cover_%28cropped%29.png
wget -O unknown/trump-obama.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Barack_Obama_and_Donald_Trump.jpg/1024px-Barack_Obama_and_Donald_Trump.jpg
wget -O unknown/funeral.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/c/c6/The_Funeral_of_President_George_H.W._Bush_%2831265101997%29.jpg/800px-The_Funeral_of_President_George_H.W._Bush_%2831265101997%29.jpg?20181206162026

and bam, it thinks Biden is Trump, but it correctly doesn't know Pence, and it finds both trump and obama in the funeral:

unknown/obama-biden.jpg,obama
unknown/obama-biden.jpg,trump
unknown/funeral.jpg,unknown_person
unknown/funeral.jpg,unknown_person
unknown/funeral.jpg,unknown_person
unknown/funeral.jpg,unknown_person
unknown/funeral.jpg,unknown_person
unknown/funeral.jpg,unknown_person
unknown/funeral.jpg,trump
unknown/funeral.jpg,obama
unknown/trump-pence.jpg,trump
unknown/trump-pence.jpg,unknown_person
unknown/trump-obama.jpg,obama
unknown/trump-obama.jpg,trump

deepface face recognition

https://github.com/serengil/deepface

pipx doesn't work: https://github.com/serengil/deepface/issues/1323 so:

virtualenv -p python3 .venv
. .venv/bin/activate
pip install deepface==0.0.93 tf_keras==2.17.0

Then:

deepface find known/trump.jpg unknown/

says:

                  identity                                                     hash  target_x  target_y  target_w  ...  source_y  source_w  source_h  threshold  distance
0                 unknown/trump-pence.jpg  0b37307c8e96b191fc25850b3f753da0a18cdd60       286        88       131  ...       181       249       249       0.68  0.432509  [1 rows x 12 columns]

and:

deepface find known/obama.jpg unknown/

says:

                  identity                                                     hash  target_x  target_y  target_w  target_h  source_x  source_y  source_w  source_h  threshold  distance 
0                 unknown/obama-biden.jpg  52db8b94ea067ba1a0b11183ebd164275c289dae       146       101       123       123       214        59       183       183       0.68  0.293305
1                 unknown/obama-biden.jpg  52db8b94ea067ba1a0b11183ebd164275c289dae       419       146       106       106       214        59       183       183       0.68  0.579007

so it is quite wrong, as it missed trump in trump-obama.jpg and found obama twice in obama-biden.jpg. And neither was found in funeral.jpg.

Bibliography:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.