Bug 426481 - Face recognition feels like a regression from 6.4
Summary: Face recognition feels like a regression from 6.4
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Recognition (show other bugs)
Version: 7.2.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-13 14:19 UTC by Martin
Modified: 2020-11-01 14:41 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.2.0


Attachments
Rebuild face training data option selected (54.92 KB, image/jpeg)
2020-09-13 19:24 UTC, Martin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2020-09-13 14:19:44 UTC
SUMMARY
Recognising faces in Digikam 6.4 often yielded good results. Having tagged a number of faces manually, it was rare that I had to correct a suggestion for a recognised face. After upgrading to 7.1 Digikam seems to almost never correctly recognise a face. Instead it often suggests an incorrect face (the wrong person for the face). As an example I have 2k+ pictures of my son's face tagged and maybe 5 of a friend's child. Digikam will suggest the other child for my son's face nearly all of the time. This didn't used to happen in 6.4 so this feels like a regression. 

I have tried rebuilding the face database with no improvement. I have also tried adjusting the setting for specificity from 50 to 90 in increments of 10 with no success - it either starts suggesting _any_ face at around 60 or no faces at around 90. There does not appear to be a sweet spot for my collection.

STEPS TO REPRODUCE
1. Run "Detect faces"
2. Manually set many faces of one person and then a few of another person from the detected faces.
3. Run "Recognise faces".

OBSERVED RESULT
Digikam suggests the incorrect face most of the time (often the less tagged face).

EXPECTED RESULT
Digikam should suggest the correct face.

SOFTWARE/OS VERSIONS
Windows: Windows 10
Comment 1 Maik Qualmann 2020-09-13 15:04:11 UTC
Have you really executed the option to recreate the training data in the maintenance tool in the face module?

The big improvements will only be available in digiKam-7.2.0.

Maik
Comment 2 Martin 2020-09-13 19:24:42 UTC
Created attachment 131610 [details]
Rebuild face training data option selected
Comment 3 Martin 2020-09-13 19:25:31 UTC
Yes (see attached to confirm tool I am talking about). I ran it again just now to be sure. Results are the same.
Comment 4 Maik Qualmann 2020-09-21 14:18:24 UTC
Please try digiKam-7.2.0-Beta1 whether the problem still exists. The training data must be rebuilt here as well.

Download from here: https://files.kde.org/digikam/

Maik
Comment 5 Martin 2020-09-21 22:17:55 UTC
Installed digiKam-7.2.0-Beta1, rebuilt the training data, reset specificity to default (70) and then scanned for faces - this all worked without error. 

Tagged a few faces and then attempted to run "Recognise faces". However, at this point it just displays a notification with the following:

"Face recognition is aborted because there are no identities to recongise. Please add new identities."

As a workaround, I tried manually selecting some images and choosing 'Item...Scan for Faces'. This worked and from my brief testing Digikam did a much better job of recognising faces correctly.

Aside: The interface / workflow improvements are great. Much easier to manage and tag faces :)
Comment 6 nonobio 2020-09-22 06:39:45 UTC
Hello,

After upgrading to 7.2.0-beta1 and rebuilding training data, a new analyze (doesn't ignore already analyzed) doesn't seem to give better results for me :

It doesn't found a lot of faces and i have none suggestions : all found faces are "Who is it ?" on a new album.

Thanks
Comment 7 nonobio 2020-09-22 12:21:55 UTC
After applying the recommandation of Maik in this comment (https://bugs.kde.org/show_bug.cgi?id=420128#c7), the recognizing seems to be quite good for me.
Comment 8 caulier.gilles 2020-09-22 13:38:43 UTC
Thanks for the feedback

Gilles Caulier
Comment 9 nonobio 2020-09-22 14:56:59 UTC
Thanks for your work :)
Comment 10 Chris 2020-10-04 09:04:44 UTC
Great work by the way. I’m a new user and installed 7.2.0 beta1. 
Face detection finds a lot of faces, but after running the recognize faces it suggests only about 1/4-1/5 faces right and all other faces are other poeople. 

Also did a reset to the faces database and assigned about 5 pictures per person and remived all wrong suggestions. 
After dunking recognize again it has the same issue with wrong suggestions. (Also tried with 50/ 60% as suggested, but the results weren’t better. 

Any other suggestions what could have caused so much wrong suggestions?
Comment 11 caulier.gilles 2020-10-04 09:31:38 UTC
Nghia,

Any suggestion for Martin ?

Gilles
Comment 12 Maik Qualmann 2020-10-04 16:29:29 UTC
Git commit 5e809db4a34bff2cbce684eab5bec13fd8586519 by Maik Qualmann.
Committed on 04/10/2020 at 16:27.
Pushed by mqualmann into branch 'master'.

Fix creation of the face DB from the beginning with MySQL

M  +2    -2    core/libs/facesengine/facedb/facedbschemaupdater.cpp

https://invent.kde.org/graphics/digikam/commit/5e809db4a34bff2cbce684eab5bec13fd8586519
Comment 13 Maik Qualmann 2020-10-04 17:01:19 UTC
We still have a problem with the creation of the new training data under MySQL, SQlite not tested. This only works if the face database table is empty. With a 2nd run the database is deleted correctly, but no identities are created and thus saving the face matrices also fails. After restarting digiKam it works.

Maik
Comment 14 Maik Qualmann 2020-10-04 17:14:05 UTC
Git commit b1469c5a3e091dcc0c1a3daa2165f4ccbc0b84ac by Maik Qualmann.
Committed on 04/10/2020 at 17:13.
Pushed by mqualmann into branch 'master'.

clear identity cache beforehand

M  +1    -0    core/libs/facesengine/recognition/facialrecognition_wrapper_training.cpp

https://invent.kde.org/graphics/digikam/commit/b1469c5a3e091dcc0c1a3daa2165f4ccbc0b84ac
Comment 15 Maik Qualmann 2020-10-04 17:16:36 UTC
The training data is now correctly rebuilt based on the confirmed faces.

Maik
Comment 16 Chris 2020-10-04 19:26:01 UTC
Will give it a try after the next weekly snapshot was created, thanks.
Comment 17 Chris 2020-10-11 18:03:37 UTC
Tried again with latest build of 20201008.

Reset the faces database in maintenance
waited till it finished rebuilding the faces database
confirmed/ rejected all old existing face suggestions
Ran "recognize faces" again with 90%
- Suggestions was right, but only 4-5 suggestions for some people

Ran "recognize faces" again with 65% 
- Having 1.400 suggestions
- But the rate of right suggestions is only about 20% (even for people with 1.000 right assigned faces)

maybe one more suggestion: if "reset face database" is run digikam should ask if all unconfirmed images should be moved to unknown. as like now I have 1.100 images with only 20% right suggestions and if I reject them all it doesn't suggest the right people again after running recognize faces again as it seems (which is good in normal use, but not if I plan to reset the database)?
Comment 18 Minh Nghia Duong 2020-10-29 07:23:54 UTC
(In reply to Chris from comment #17)
> Tried again with latest build of 20201008.
> 
> Reset the faces database in maintenance
> waited till it finished rebuilding the faces database
> confirmed/ rejected all old existing face suggestions
> Ran "recognize faces" again with 90%
> - Suggestions was right, but only 4-5 suggestions for some people
> 
> Ran "recognize faces" again with 65% 
> - Having 1.400 suggestions
> - But the rate of right suggestions is only about 20% (even for people with
> 1.000 right assigned faces)
> 
> maybe one more suggestion: if "reset face database" is run digikam should
> ask if all unconfirmed images should be moved to unknown. as like now I have
> 1.100 images with only 20% right suggestions and if I reject them all it
> doesn't suggest the right people again after running recognize faces again
> as it seems (which is good in normal use, but not if I plan to reset the
> database)?

Hi Chris,

Does the face recognizer get better overtime? Because the new face recognizer is machine learning based so it's need to be train with enough data in order to predict correctly. If it still sucks, can you describe briefly its problems please?

Nghia
Comment 19 Chris 2020-10-29 08:42:39 UTC
Hi Nghia, 

Thanks for the reply. For me it gets worse over time unfortunately. 

I started using 7.2.0 beta with photos exported from Apple photos app, so there wasn’t any photos in the EXIF file in the beginning. 

Started doing this: 
Run detect faces. 
I did set the name for some people and let it recognize faces then. First the results where relatively good (would say 50% of the suggestions was right), as it recognized most photos from the same day of that Person. 
Confirmed right photos and set the right name for the wrong suggestions. 

(Repeated the following two steps about 10-15 times without getting above the 20% right suggestions) 
Run recognize photos again, with now about 20% right faces. 
Confirmed right photos and set the right name for the wrong suggestions. 


Reset the faces database in management. 
Run detect & recognize photos again with the same results. 

Last time I deleted the whole database files, (as seen in the last post) run detect and recognize photos again and had the results mentioned then. 

Next run I’m again at only 20% right suggestions. (Even for people where I confirmed abou 700-1.500 faces now). 

Is the machine learning also run for already confirmed photos after resetting the faces database? If not maybe that would extremely optimize the recognition? Optionally for sure, as it would have to run over all faces.
Comment 20 Martin 2020-11-01 14:41:52 UTC
Following up on my original issue; I just downloaded the released 7.2.0-beta1 and it works very well now. Thanks again :)