matiasdelellis / facerecognition

Nextcloud app that implement a basic facial recognition system.
GNU Affero General Public License v3.0
510 stars 46 forks source link

Your friends have not been recognized yet #479

Closed vipenm closed 3 years ago

vipenm commented 3 years ago

Expected behaviour

After running occ face:background_job -t 900 images should show in Face Recognition app

Actual behaviour

I just get the "Your friends have not been recognized yet" message

Steps to reproduce

  1. Run occ face:background_job -t 900
  2. Successfully completes
  3. Images dont show

Server configuration

$ python3 scripts/face_detect.py
Welcome to pdlib min test suite for Facerecognition app

First we try to open the models... Done

Processing file: input/Big Bang Theory.jpg
Number of faces detected: 3
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Processing file: input/Big Bang Theory.png
Number of faces detected: 7
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done

$ php scripts/face_detect.php
Welcome to pdlib min test suite for Facerecognition app...

First we try to open the models... Done

Processing file: input/Big Bang Theory.jpg
Number of faces detected: 3
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Processing file: input/Big Bang Theory.png
Number of faces detected: 7
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done
Face landmarks... Done
Face descriptor... Done

Client configuration

Logs

Background task log with debug.

occ -vvv face:background_job ``` $ occ -vvv face:background_job 1/10 - Executing task CheckRequirementsTask (Check all requirements) System: Linux System memory: 14596591616 PHP Memory Limit: 2147483648 2/10 - Executing task CheckCronTask (Check that service is started from either cron or from command) 3/10 - Executing task LockTask (Acquire lock so that only one background task can run) 4/10 - Executing task DisabledUserRemovalTask (Purge all the information of a user when disable the analysis.) yielding 5/10 - Executing task StaleImagesRemovalTask (Crawl for stale images (either missing in filesystem or under .nomedia) and remove them from DB) Skipping stale images removal for user sneek as there is no need for it 6/10 - Executing task CreateClustersTask (Create new persons or update existing persons) Found 0 faces without associated persons for user sneek and model 1 Clusters already exist, estimated there is no need to recreate them yielding 7/10 - Executing task AddMissingImagesTask (Crawl for missing images for each user and insert them in DB) Skipping full image scan for user sneek 8/10 - Executing task EnumerateImagesMissingFacesTask (Find all images which don't have faces generated for them) yielding 9/10 - Executing task ImageProcessingTask (Process all images to extract faces) NOTE: Starting face recognition. If you experience random crashes after this point, please look FAQ at https://github.com/matiasdelellis/facerecognition/wiki/FAQ 10/10 - Executing task UnlockTask (Release obtained lock) ```

Web server error log

NIL

Nextcloud log (data/nextcloud.log)

NIL

Browser log

Browser log No errors in console Empty `persons` XHR: ``` enabled: true persons: [] ```

Additional Information

SELECT * FROM oc_facerecog_images | id | user | file | model | is_processed | error | last_processed_time | processing_duration | |----|-------|------|-------|--------------|-------|---------------------|---------------------| | 1 | sneek | 238 | 1 | 1 | NULL | 2021-05-20 18:49:24 | 2340 | | 2 | sneek | 243 | 1 | 1 | NULL | 2021-05-20 18:49:22 | 2652 | | 3 | sneek | 241 | 1 | 1 | NULL | 2021-05-20 18:49:27 | 2384 | | 4 | sneek | 236 | 1 | 1 | NULL | 2021-05-20 18:49:29 | 2449 | | 5 | sneek | 237 | 1 | 1 | NULL | 2021-05-20 18:49:34 | 2434 | | 6 | sneek | 244 | 1 | 1 | NULL | 2021-05-20 18:49:22 | 0 | | 7 | sneek | 240 | 1 | 1 | NULL | 2021-05-20 18:49:32 | 0 | | 8 | sneek | 239 | 1 | 1 | NULL | 2021-05-20 18:49:34 | 0 | | 9 | sneek | 245 | 1 | 1 | NULL | 2021-05-20 18:49:22 | 0 | | 10 | sneek | 242 | 1 | 1 | NULL | 2021-05-20 18:49:32 | 2511 | | 11 | sneek | 235 | 1 | 1 | NULL | 2021-05-20 18:49:22 | 0 |
SELECT * FROM oc_facerecog_persons | id | user | name | is_valid | last_generation_time | linked_user | |----|-------|------|----------|----------------------|-------------| | 1 | sneek | NULL | 1 | 2021-05-20 19:18:31 | NULL | | 2 | sneek | NULL | 1 | 2021-05-20 19:18:31 | NULL | | 3 | sneek | NULL | 1 | 2021-05-20 19:18:31 | NULL | | 4 | sneek | NULL | 1 | 2021-05-20 19:18:31 | NULL | | 5 | sneek | NULL | 1 | 2021-05-20 19:18:31 | NULL | | 6 | sneek | NULL | 1 | 2021-05-20 19:18:31 | NULL |
matiasdelellis commented 3 years ago

Hi @vipenm Considering the small tables that you are sharing, you did a test with few photos.. With so little photos, can not clustering the faces, and therefore each face is a person. The persons 'view' does not suggest individual faces mainly due to server performance.. Then you won't be able to name them in this view until you have more photos and they are grouped.. but you can name it in the photos and files application, using the sidebar and then you can see it in this view. 😉

mmm.. Maybe it should be added to the faq.. 🤔

vipenm commented 3 years ago

That actually makes sense duhh 😊

I've uploaded a batch of images now and it's working - a thing to note, I ran the occ face:background_job -t 900 but it wasn't detecting any of the new images - only the original 11. I had to run occ face:reset --model and then re-run the background job for it to find it. Is this normal? I did wait a few minutes just in case it needed time to find the new files but didn't find them before the reset - do you usually have to wait a while?

Anyway, I'm happy to close out this issue as the original is no longer a problem but will keep an eye out to see if new images are found after a cron

Cheers

matiasdelellis commented 3 years ago

I've uploaded a batch of images now and it's working - a thing to note, I ran the occ face:background_job -t 900 but it wasn't detecting any of the new images - only the original 11. I had to run occ face:reset --model and then re-run the background job for it to find it. Is this normal?

NO, How you added the photos? What storage do you use?

vipenm commented 3 years ago

Photos were added through Samba and it's a mounted internal HDD. The photos did appear in Nextcloud but couldn't be found in the background_job task.

The job does work however when the photos are uploaded through the mobile Nextcloud app's Auto Upload feature so I'm not too concerned as this will be how most, if not all, photos will be uploaded

matiasdelellis commented 3 years ago

Photos were added through Samba and it's a mounted internal HDD. The photos did appear in Nextcloud but couldn't be found in the background_job task. The job does work however when the photos are uploaded through the mobile Nextcloud app's Auto Upload feature so I'm not too concerned as this will be how most, if not all, photos will be uploaded

OK ok.. It is normal that it does not detect it when you add photos outside of nexcloud. When nextcloud adds new files, it emits a hook, and that is what informs this application that it should analyze the image. So, when you do it externally there is no an standard way to detect new images.

adyanth commented 2 years ago

.