Comments (16)
definetely i will. we will add it because of its accuracy for asian faces.
btw - feel free to continue discussion this thread. the reason I closed it that I only set tickets open only if that requires code change.
from deepface.
you are using different models in verify and find functions. one is vgg, other is dlib.
TLDR: find and verify do the same, just find stores already calculated thresholds in a pickle file to find faster in next run.
from deepface.
My bad I pasted wrong code, I tried with the same models and I edited the same, with same model, with the same threshold results are different. i think this needs a fix. I also tried loosening the threshold distance of find function but there is no improvements. so how can i achieve faster and accurate results using find similar to verify method. Anyway thanks for this amazing repo.
from deepface.
if a photo has many faces, then verify considers the most similar one between the other photo.
on the other hand, find calculates distances for each face. this is the only difference.
from deepface.
ok. but i'm extracting all the faces in an image and saving them as individual images into a folder. and using this folder i'm checking the unique_faces folder. so there aren't any mutliple faces in a single image.
from deepface.
you may try to print distance values between image pairs. if you see any difference on these distance values for same image pair, we can continue to discuss.
from deepface.
yes...that is what I'm exactly trying to say...
here is the code for verify function
import os
from deepface import DeepFace
def verify_image_against_folder(image_path, folder_path):
try:
verified_results = {}
for filename in os.listdir(folder_path):
if filename.endswith(('.jpg', '.jpeg', '.png')):
image_to_compare_path = os.path.join(folder_path, filename)
result = DeepFace.verify(image_path, image_to_compare_path)
if result["verified"]:
verified_results[filename] = result
except:
pass
return verified_results
# Usage example:
reference_image_path = "Madhursample.jpg"
folder_path_to_compare = "dbmod"
results = verify_image_against_folder(reference_image_path, folder_path_to_compare)
# Print results
for filename, result in results.items():
print(f"Verification result for {filename}: {result['verified']}")
print(f"Distance: {result['distance']}")
and the output is
Verification result for AdityaVikramBudholiya_EMqaTest-3$00-0000-0000-000000024758_face.jpg: True
Distance: 0.6586338087844334
Verification result for VivekKumarGupta_EMqaTest-3$00-0000-0000-000000024832_face.jpg: True
Distance: 0.6253741569539091
and for find function the code is
from deepface import DeepFace
result=DeepFace.find("Madhursample.jpg",db_path="dbmod",enforce_detection=False)
print(result)
and the output is
[ identity hash target_x target_y ... source_w source_h threshold distance
0 dbmod/AlokKumar_EMqaTest-3$00-0000-0000-000000... de05dfb9108ac362273ee2f033e1db9a961cd360 47 209 ... 73 73 0.68 0.533479
1 dbmod/VivekKumarGupta_EMqaTest-3$00-0000-0000-... 69e1254b38d6875b382ffb4012261f98761fcc06 50 60 ... 73 73 0.68 0.625374
2 dbmod/ManishRanjan_EMqaTest-3$00-0000-0000-000... 3c107ea80669c3a2c37526ef9a102e505d398905 88 276 ... 73 73 0.68 0.639899
3 dbmod/Madhur_face.jpg aaa8fe54fc30574dba2ce19ec28eb60fa49fc49b 47 50 ... 73 73 0.68 0.640093
4 dbmod/AdityaVikramBudholiya_EMqaTest-3$00-0000... ff05c12f927aa766d5834d9015e01af5cee31be1 32 77 ... 73 73 0.68 0.658634
5 dbmod/SiddarthJain_EMqaTest-3$00-0000-0000-000... 32eab590a3ddec2225fa854a2a4e6596fcc644ac 37 176 ... 73 73 0.68 0.679664
[6 rows x 12 columns]]
As you can see, between the 2 results even though input image and folder are same, model [by default is VGG-face] so only difference is methods.
from deepface.
As I see from your results, find and verify are returning same. What is different?
Madhursample.jpg
vs AdityaVikramBudholiya_EMqaTest-3$00-0000-0000-000000024758_face.jpg
Verify: 0.6586338087844334
Find: 0.658634
Madhursample.jpg
vs VivekKumarGupta_EMqaTest-3$00-0000-0000-000000024832_face.jpg
Verify: 0.6253741569539091
Find: 0.625374
from deepface.
distances are same but the results are not. That is my concern..
from deepface.
if distances are same, then there is nothing wrong from the library's perspective.
the procedure to list images in your implementation and find function are different. for instance, if an image is webp but its extension is jpg/png, then this is discarded in find function but it is not discarded in your implementation.
https://github.com/serengil/deepface/blob/master/deepface/commons/image_utils.py#L16
from deepface.
No, I took care of that already, I have only .jpg files.
from deepface.
May be using insightface would give me better results as it got better accuracy on south asian and east asian faces..
from deepface.
yeah got it. i have a folder of faces and an empty folder, [unique_faces_folder name]. now I'll add first face to the folder and from 2nd image i have to compare it if it is previously there in the folder or not, so incase there are n images stored in the unique_faces folder and i have to check for another m images it is taking too much time and the results are not that good but satisfactory. but if we choose find method, even though it needs to fetch new representations and save them it is giving results very quickly but varying from verify method.
from deepface.
Most probably, your logic is buggy because verify gives same distances with find when tested directly.
from deepface.
For instance, listdir does not list files in subfolders. But find function considers sub folders. You are running a different logic.
from deepface.
Oh I didn't know that, but also there are no sub folders inside my current working directory.
from deepface.
Related Issues (20)
- centerface's float coordinates HOT 1
- Minimum hardware requirements HOT 1
- DeepFace Facial Recognition HOT 1
- 'dfs' is not recognized as an internal or external command, operable program or batch file. HOT 6
- Access to age gender models HOT 1
- You are running it in windows instead of python. Run python command in your terminal and then run find command in python. HOT 3
- No Item found in Database HOT 5
- I did what you commented and now this happened HOT 10
- i finally got it working! but its taking representation from my files? i thought it was going to cross reference the facial features of this person in the photo of mine with the endless list of people with photos of your facial rec listing? HOT 5
- Face detection and emtion recognition for extreme pose HOT 3
- Emotion detector performance HOT 1
- error with deepface.stream HOT 3
- [BUG]: issue created with template for test
- Request for support of model conversion like in .onnx or .engine file. HOT 2
- [FEATURE]: extract_faces return face center point info or stop further enlargement if face center point can't be kept at image center HOT 8
- [BUG]: TypeError: unhashable type: 'list' HOT 2
- Fine Tuning Threshold in Face Recognition HOT 1
- New api endpoint HOT 4
- [BUG]: license is not shown in pip package
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepface.