Exchange on Face recognition and Face comparison

Everything else that doesn't fall into one of the other PB categories.
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Exchange on Face recognition and Face comparison

Post by dige »

Hi folks,

I would like to build a face recognition system with OpenCV or Python / dlib.

Than determine the vectors (embeddings) of the recognized faces and save them in a vectore database like chromaDB.
And thus have the possibility to compare faces e.g. with Cosine Similarity.

In other words, in the same way that https://facecheck.id/ is breathtakingly fast and effective.

This is what ChatGPT suggested to me.

Now my actual question: who is already familiar with this area? How would you do it?
In the forum there are already codes to recognize faces via the Windows API or from JHP JHP a face recognition with OpenCV.
How would you determine the face vectors?
Is it a good idea to do the whole thing using RunProgram() and Python?

I appreciate any tips! Thanks!!!

Ciao Dige
"Daddy, I'll run faster, then it is not so far..."
Sergey
User
User
Posts: 53
Joined: Wed Jan 12, 2022 2:41 pm

Re: Exchange on Face recognition and Face comparison

Post by Sergey »

Yes, you're may run deepface on Python
https://github.com/serengil/deepface
Last released on Aug 17, 2024

Works well, every model about 500 MB (gender, race, age)
And maybe anybody transfer this project to PB once
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: Exchange on Face recognition and Face comparison

Post by dige »

Thank you Sergey, Deepface looks very promising. Let's see if I can get it to run on Windows.
"Daddy, I'll run faster, then it is not so far..."
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: Exchange on Face recognition and Face comparison

Post by dige »

-Update-

Wow, that's fantastic!
Recognizing faces, age, emotion etc. works very well.

If you want to try it out (under Windows).
I have Python 3.12. Python installed -> https://www.python.org/downloads/
Make sure you select “Add Python to PATH” when installing!

Open a command prompt (CMD) or PowerShell and create a virtual environment:

python -m venv deepface_env
cd deepface_env
Scripts\activate

DeepFace requires some Python libraries. Install them with:
pip install deepface

I then had to install tf_keras manually:
pip install tf-keras

Now try out Deepface
Start Python

from deepface import DeepFace

result = DeepFace.analyze(“C:\\temp\\test.jpg”, actions=['age', 'gender', 'emotion', 'race'])
print(result)

Next I will try to encapsulate this with PureBasic and process the recognized faces and their characteristics
"Daddy, I'll run faster, then it is not so far..."
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Exchange on Face recognition and Face comparison

Post by Caronte3D »

dige wrote: Tue Mar 11, 2025 10:04 am Next I will try to encapsulate this with PureBasic and process the recognized faces and their characteristics
This would be fantastic! :D
Sergey
User
User
Posts: 53
Joined: Wed Jan 12, 2022 2:41 pm

Re: Exchange on Face recognition and Face comparison

Post by Sergey »

dige wrote: Tue Mar 11, 2025 10:04 am Wow, that's fantastic!
Recognizing faces, age, emotion etc. works very well.
I knew that you would like it
It also very simple to use
And it has many face detectors, try each of them

I wish you success in the adaptation of DeepFace on Purebasic 8)
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: Exchange on Face recognition and Face comparison

Post by dige »

Dropping a quick update:

Got some solid progress:

✅ Importing an entire image directory
✅ Extracting faces
✅ Analyzing age, emotions, race & generating embeddings

💾 Embeddings are stored in ChromaDB
🔍 Face search now works – can find faces & measure similarity

So far, everything's still running purely in Python and its very slow :|

⚡ Next step: PureBasic will handle everything on a meta level.
"Daddy, I'll run faster, then it is not so far..."
miso
Enthusiast
Enthusiast
Posts: 409
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: Exchange on Face recognition and Face comparison

Post by miso »

I'm not a lawyer, but detecting emotions with an AI is restricted by a brand new EU AI Act. I think. I'm not a lawyer.
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: Exchange on Face recognition and Face comparison

Post by dige »

You are right, but its ok for private use
"Daddy, I'll run faster, then it is not so far..."
Post Reply