Bug 504077 - Face thumbnail generation
Summary: Face thumbnail generation
Status: REPORTED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Workflow (other bugs)
Version First Reported In: 8.6.0
Platform: Mint (Ubuntu based) Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-11 20:45 UTC by matthieu04
Modified: 2025-06-02 21:04 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Digikam output during face thumbnail recognition (93.60 KB, text/plain)
2025-05-12 19:04 UTC, matthieu04
Details
sample image (3.68 MB, image/jpeg)
2025-05-12 19:35 UTC, matthieu04
Details
Trace digikam appimage (1.43 MB, text/plain)
2025-05-12 20:34 UTC, matthieu04
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matthieu04 2025-05-11 20:45:54 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Please remove this comment after reading and before submitting - thanks!
***

SUMMARY
Many face thumbnails were blank and it takes 1-20 seconds to generate each one, this seems excessive. Other I/O operations on the same disc are fast. Original images are either JPG or HEIC. Images are on local HD or on NAS, Digikam DB is on sqlite, on a SSD. 
I have a very large database (>250k photos, most of them are on the NAS
Can I generate all face thumbnails all at once, maybe overnight?


STEPS TO REPRODUCE
1.  Generate a large database with local image and network image on NAS
2. Run face generation
3. Try to classify the faces

OBSERVED RESULT
Some face thumbnails are here, some are blank

EXPECTED RESULT
All face thumbnails are generated

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma:  Linux Mint
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 caulier.gilles 2025-05-12 03:46:20 UTC
Have you downloaded all AI models files proposed at startup ? If no you can do it using DK/Setup/Miscs/System dialog page. 

Can you run digiKam from a console as explained in this page ?

https://www.digikam.org/contribute/#linux-host
Comment 2 matthieu04 2025-05-12 19:04:41 UTC
Created attachment 181223 [details]
Digikam output during face thumbnail recognition

Digikam output during face thumbnail recognition
Comment 3 matthieu04 2025-05-12 19:05:14 UTC
Hello, you'll find enclosed the requested traces. Thank you
Comment 4 Maik Qualmann 2025-05-12 19:24:42 UTC
This looks like broken images or something similar, a sample is needed.

/media/SynoCousin_photo/[Archive]/2021 - Photos/2021 Divers/20210731_131702.jpg" : Unknown image format !!!

Maik
Comment 5 matthieu04 2025-05-12 19:35:04 UTC
Created attachment 181225 [details]
sample image
Comment 6 matthieu04 2025-05-12 19:35:58 UTC
Here it is
Comment 7 Maik Qualmann 2025-05-12 19:58:48 UTC
No problem with the sample image here.
Strange, if the problem occurs for you, no loader plugin can identify the image path, neither via the file extension nor, in the second attempt, via the magic bytes.
Network path temporarily unavailable?

Maik
Comment 8 Maik Qualmann 2025-05-12 20:02:39 UTC
Ah, I see Ubuntu, but you're not using the digiKam Snap package from Ubuntu? Snap is completely useless for digiKam and uses a sandbox; only local files in the home directory can be processed.
Use our AppImage instead.

Maik
Comment 9 Michael Miller 2025-05-12 20:08:24 UTC
(In reply to Maik Qualmann from comment #8)
> Ah, I see Ubuntu, but you're not using the digiKam Snap package from Ubuntu?
> Snap is completely useless for digiKam and uses a sandbox; only local files
> in the home directory can be processed.
> Use our AppImage instead.
> 
> Maik

Thanks Maik.  I downloaded the attached test image and everything processed normally.  All face regions were detected.  No false positives we created.

Cheers,
Mike
Comment 10 matthieu04 2025-05-12 20:33:42 UTC
(In reply to Maik Qualmann from comment #8)
> Ah, I see Ubuntu, but you're not using the digiKam Snap package from Ubuntu?
> Snap is completely useless for digiKam and uses a sandbox; only local files
> in the home directory can be processed.
> Use our AppImage instead.
> 
> Maik

Hello, 

I downloaded the appimage, here is the trace.

Around 1 face is generated per 2-3seconds. Maybe it is normal since it is the first run and that files are on a NAS?
Comment 11 matthieu04 2025-05-12 20:34:04 UTC
Created attachment 181228 [details]
Trace digikam appimage
Comment 12 matthieu04 2025-05-12 21:30:47 UTC
It feels like digikam generates the face thumbnail only when the face is being viewed, and not beforehand, when the face was detected... 

Is it the expected behaviour?

If yes, it can be very slow, especially because it will usually be done in parallel with classifying (while a person is being classified on WAL, you want to display the next one to start classifying). It would be more practical to be able to generate all face thumbnails at once
Comment 13 Maik Qualmann 2025-05-13 06:42:35 UTC
The image loading error doesn't occur with AppImage, at least. And yes, sometimes face thumbnails are created during display for newly imported images with face regions. However, if I'm right, Michael has also integrated thumbnail creation for face detection. We can look into it again, though. We already have other bug reports on the topic of face thumbnail creation. So we can basically close this one.

Maik
Comment 14 Michael Miller 2025-05-13 12:19:40 UTC
(In reply to Maik Qualmann from comment #13)
> The image loading error doesn't occur with AppImage, at least. And yes,
> sometimes face thumbnails are created during display for newly imported
> images with face regions. However, if I'm right, Michael has also integrated
> thumbnail creation for face detection. We can look into it again, though. We
> already have other bug reports on the topic of face thumbnail creation. So
> we can basically close this one.
> 
> Maik

Hi Maik,
You are correct.  The face engine creates thumbnails when the face is first detected in an image.

https://invent.kde.org/graphics/digikam/-/blob/master/core/utilities/facemanagement/pipelines/detectrecognize/facepipelinedetectrecognize.cpp#L745

The thumbnail is stored in the tumbnails-digikam DB.  If this database is running from a remote server, then loading the thumbnail image will be slower.

Cheers,
Mike
Comment 15 matthieu04 2025-05-13 14:28:26 UTC
Hello,

My database is running on local SSD, so loading should be fast. I guess that the face thumbnail was not properly generated upon analyzing, and digikam has to re-generate it upon displaying. I can send you new traces if needed, to confirm. Otherwise you can close, if similar face thumbnail generation report are already adressed in another bug report.