Bug 461838

Summary: All face thumbnails in a picture are recreated after a face is tagged, which is not optimal performance-wise
Product: [Applications] digikam Reporter: MarcP <iwannaberich>
Component: Faces-WorkflowAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: caulier.gilles, iwannaberich, metzpinguin
Priority: NOR    
Version: 8.0.0   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=466412
Latest Commit: Version Fixed In: 8.2.0
Sentry Crash Report:

Description MarcP 2022-11-14 20:13:48 UTC
SUMMARY
I believe it was already mentioned in another bug report, but today I had to face-tag a series of pictures of a family reunion which included more than 20 people each, and it reminded me that I could mention this to you developers. 

During the face-tagging process, I had to wait minutes between each tagging because digikam reconstructs all the face miniatures in a photo after any modification. And I'm not sure if the picture file needs to be accessed for each miniature, but they are generated one by one. 

That means that if there are 20 faces on a picture, and it takes 3 seconds to recreate the thumbnail, I will have to wait a minute to tag a face in the same picture. Moreover, this inconvenience is aggravated by what was described in bug 395241, in which faces only load as you scroll through them.

I'm sure there's a reason why this is done this way, but wouldn't there be a more efficient way? Face positions or content is not something that change when a face is tagged, so previously existing faces wouldn't need to be refreshed. Or if the refresh is compulsory, why not temporarly show the "old" face before re-generating it, so it doesn't appear blank all that time? 
I've seen that what other pictures managers do, is to temporarly use a zoomed-in fragment of the main picture before loading the high-resolution face, in order to prevent blank thumbnails while they are being constructed.

What do you think?

PS: sorry if it came out as a bit of rant, it wasn't my intention, I was just brainstorming for possible improvements. Keep up the good work!


STEPS TO REPRODUCE
1. Take a picture with multiple people in it, and scan it for faces. Wait for the scan to finish
2. Go to the People panel, "Unknown" category, so the faces on the picture are ready to be tagged
3. Tag one of the faces. 

OBSERVED RESULT
- All the rest of the faces in that picture become "blank" for a while, and they are regenerated one by one, taking some time for each one (depending on the file access speed).

EXPECTED RESULT
- The rest of the faces don't need to be re-generated since the content of the picture hasn't changed, only the metadata.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Kubuntu 22.04 LTS
digiKam-8.0.0-git-20221108T185710-x86-64.appimage
Comment 1 Maik Qualmann 2022-11-14 20:23:21 UTC
The thumbnails are not recreated, why should they? Yes, they are all reloaded as there has been a metadata change. I've been examining a lot of code in the process of making improvements to digiKam-8.0.0 to see if we can optimize further. No, there aren't many options left.

Maik
Comment 2 MarcP 2022-11-14 20:30:05 UTC
But the thumbnails are reloaded from the picture iself, not from the thumbnail already existing in the database, aren't they? In a NAS, that would mean that a single picture would need to be transferred 20 times if there are 20 faces in it. Or am I getting it wrong? Couldn't all the faces in a picture be refreshed from a single transfer?

Anyway, it's a pity. Would it be possible to have two kinds of refresh, one that just refreshes the metadata, and another one that also refreshes thumbnails and face-thumbnails?
Comment 3 MarcP 2022-11-14 20:40:16 UTC
Ok, I have checked the traffic on my NAS, and yes, a single picture will be transferred as many times as faces there are in the photo (so, 100MB for a 5MB photo with 20 faces on it). Couldn't digikam get the photo just once, and recreate all the face-thumbnails from that info? That would greatly improve the performance.
Comment 4 caulier.gilles 2023-05-05 14:44:43 UTC
Maik,

But we have a large memory cache used to reduce network idle... right ?

Gilles
Comment 5 Maik Qualmann 2023-09-03 19:51:21 UTC
Using my small thumbnail database from Bug 474105, I can confirm that we don't create a new thumbnail when the face is tagged. I would close this bug for digiKam-8.2.0.

Maik
Comment 6 caulier.gilles 2023-10-10 03:06:44 UTC
Fixed with #474105