Closed s-rac53 closed 3 months ago
The idea behind pickle is to have less time once you found the embeddings of your facial database. Results seem normal.
Can you see below that it's taking more time to execute when I run it again. Can you point out what's happening? It took me 4 minutes to execute the first time as opposed to 18 minutes and continuing.
Cannot see how long does find function take in 1st and 2nd run in the screenshot.
If you have gpu, you may try to disable it
os.environ['CUDA_VISIBLE_DEVICES'] = "-1"
or
os.environ['CUDA_VISIBLE_DEVICES'] = ""
looking at the below screenshots and the highlighted areas it is clear that the representations are piling up every time the find function runs. The pickle file is growing tremendously. I did not have this issue last month when I ran this same database location with the same number of files. I'm running Deepface in Google Colab. P.S. I have not added extra images to the database location. I have tried your suggestion to disable GPU but to avail no joy.
There were 64 items in first screenshot, 836 in second one. Size of your db is growing. This is the problem.
The number of images in the database are the same nevertheless. Do you have any suggestions or turnarounds?
I need to reproduce the problem to make a comment.
Okay thanks!
@s-rac53 there are some things to check for trying to dissect your problem. I'm trying to provide some hints (not sure they apply to your problem but are good starting points)
A question arises : is it possible you save the detected faces as images in the same dataset directory of the original images ? If it is so then the behavior is expected. I'd personally suggest to verify the number of images in the origin directory before the first round and before the second round and compare the overall number of images.
Another thing to take into account: when find
starts it inspects the contents of the provided directory and all images contained in subdirectories (i.e. the scan for images is recursive). Is it possible your application saves some additional images in subdirs ?
Third hint: the logic to detect for changed images amongst rounds relies on hashing of some properties of input image files (file size, creation date, modification date). If, in the interval amongst first round and second one, any of those properties change then the hash will change as well and the file is reprocessed.
Again: I don't know if this is the problem but I hope this gives you useful hints to investigate the issue.
Hi @AndreaLanfranchi, Thank you for taking your time on my issue. You hints seem useful to understand the premise of my issue. These are my findings:
Hope more light could be shed on this!
Hi @s-rac53, thank you for feed-back. I suggest we proceed step.by-step. Let's consider this initial pic
The log line saying "Finding representations [...] 12/12" shows us the app have found 12 new images since last run (or if the pickle file was not found - hence its been created from scratch). For each image a detection phase is invoked and for every detected face on each picture a digital representation is generated. The line "There are now 64 representations [,,,]" informs us the whole pictures directory contains 64 faces and each one has been represented.
Does this makes sense for you ? How many image files do you have in the directory ? The number of 64 faces is consistent with what you expect ?
Hi @AndreaLanfranchi,
I executed DeepFace's find function on my computer and found no error in the number of representations being saved in the pickle file. It seems like what you speculated on point 3 in your earlier comment must be true! There is some level of modification happening to the images in the database retrieved from my Drive.
Thanks for your time again! It seems like the issue is resolved for me at the moment. Cheers :)
Nice. Feel free to get back to me should you have any further trouble. Have a great day.
I sure will. Thank you.
Hi Serengil,
In the below image as you can see there are 64 representations created for the database of 12 images on which the find function is run against. The issue happens when I try to run the find function again because this time it runs over 64 representations and takes an exponential time to execute. The facial recognition results are flawless but the idea of using a pickle file here is being counter productive and time consuming. Please point out the mistake I'm making/ lapse in my understanding.![deepface](https://github.com/serengil/deepface/assets/75831003/7897c0e4-5d1c-444a-ae31-dcbc4fc09ad9)