Bug 506663 - Face recognition finds nothing
Summary: Face recognition finds nothing
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Recognition (other bugs)
Version First Reported In: 8.7.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-06 07:28 UTC by Unknown
Modified: 2025-07-20 04:22 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.8.0
Sentry Crash Report:


Attachments
digikam stdout/err log (165.89 KB, text/plain)
2025-07-14 18:23 UTC, Charlie Gorichanaz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown 2025-07-06 07:28:45 UTC
'Recognize faces only' does not suggest anything, even when the accuracy is set to 1 — I also tried 10. 

I also tried 'Tools > Maintenance > Rebuild all training data', but it didn't help.

digikam.facesengine: FaceClassifier::loadTrainingData: exception:  OpenCV(4.12.0) /usr/include/opencv4/opencv2/core/mat.inl.hpp:921: error: (-215:Assertion failed) (unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()) in function 'at'

digikam.facesengine: FaceClassifier::loadTrainingData: training completed in  114 ms

digikam.facedb: FaceDB SelectFaceSetting val ret = 0

digikam.facesengine: Creating new instance of DNNFaceDetectorYuNet
digikam.facesengine: Face detection model: "YuNet" ready
digikam.facesengine: Finish aligning face in  24  ms
digikam.facesengine: Start neural network
digikam.facesengine: Finish computing face embedding in  79  ms
digikam.facesengine: FacePipelinePackageBase::~FacePipelinePackageBase: Deleting package with serial number 1
digikam.facesengine: Finish aligning face in  11  ms
...
digikam.facesengine: Start neural network
digikam.facesengine: Finish computing face embedding in  18  ms
digikam.facesengine: FacePipelinePackageBase::~FacePipelinePackageBase: Deleting package with serial number 4502
digikam.mlpipelinefoundation: Stage: 0  Items Processed: 4502  Max Thread Count: 1  Max Queue Depth: 0  Total Elapsed: 10857  Max Elapsed: 10857  Avg Elapsed: 2
digikam.mlpipelinefoundation: Stage: 1  Items Processed: 4502  Max Thread Count: 1  Max Queue Depth: 4250  Total Elapsed: 132654  Max Elapsed: 83  Avg Elapsed: 29
digikam.mlpipelinefoundation: Stage: 2  Items Processed: 4502  Max Thread Count: 1  Max Queue Depth: 4  Total Elapsed: 132747  Max Elapsed: 104  Avg Elapsed: 29
digikam.mlpipelinefoundation: Stage: 3  Items Processed: 4502  Max Thread Count: 1  Max Queue Depth: 1  Total Elapsed: 7  Max Elapsed: 2  Avg Elapsed: 0
digikam.mlpipelinefoundation: Stage: 5  Items Processed: 4502  Max Thread Count: 1  Max Queue Depth: 1  Total Elapsed: 197  Max Elapsed: 9  Avg Elapsed: 0
digikam.mlpipelinefoundation: Total Elapsed: 135077
digikam.general: Event is dispatched to KDE desktop notifier
kf.notifications: No event config could be found for event id "FacesEngine (FaceScanWidget)" under notifyrc file for app "digikam"
Comment 1 caulier.gilles 2025-07-06 07:34:40 UTC
Which Linux system ?
Did you use the AppImage bundle ?
Did you have a GPU card recognized for the DNN ?

Best

Gilles Caulier
Comment 2 Unknown 2025-07-06 07:51:06 UTC
>Which Linux system ?
Arch KDE Plasma

>Did you use the AppImage bundle ?
No, but I tried it now, and the recognition seems to be working OK

>Did you have a GPU card recognized for the DNN ?
digikam.dnnmodelmanager: Using default backend and CPU target
Comment 3 caulier.gilles 2025-07-06 08:13:35 UTC
If the AppImage work fine, so it's a packaging problem from Arch Linux. Report this problem to Arch team.

By GPU, i want mean which video card did you use exactly ?
Comment 4 Charlie Gorichanaz 2025-07-14 18:02:55 UTC
This issue was brought up a few times on the digikam-users mailing list (Topic: "Still cant figure out face recognition under 8.7"). One user reported recognition not working on Windows 11 digikam 8.7. Two users (myself included) report the issue on Arch Linux.

I did recently configure my system to use the discrete NVIDIA GeForce RTX 4070 Laptop GPU for digikam, previously I was using the CPU only on my laptop with an Intel Core Ultra 9 185H CPU. I did this by installing some packages related to "PRIME render offload" (https://wiki.archlinux.org/title/PRIME#PRIME_render_offload) and set an alias in my environment as: digikam='prime-run digikam'. I thought this allowed digiKam to report that it was using the GPU when I clicked the "Test GPU AI compatibility" button under Misc > System, but now I am looking at that output and am not certain. It says it can use GPU but also reporting Intel ARC Graphics.

```
Starting OpenCV OpenCL DNN test...
Checking for OpenCL GPU acceleration compatibility with AI models...
OpenCL is available on this system.
OpenCL acceleration device is available.
Using device: Intel(R) Arc(TM) Graphics
Loading test image...
Preparing the image for processing...
Initializing face detection model...
Running face detection...
Initializing feature extraction model...
Preparing face for feature extraction...
Extracting face features...
All tests completed successfully!

Test completed successfully! Your system can use GPU acceleration for the AI models.
```

I run nvtop and it is not showing my NVIDIA graphics card as being used. So I may have a misconfiguration that cropped up and will need to debug later.

I'm not sure if this is helpful, but here is what my terminal logs back when I launch digikam and run a "Recognize faces only" scan on a few albums where I have not yet recognized faces:

```
$ prime-run digikam
digikam: /usr/lib/libgphoto2_port.so.12: no version information available (required by /usr/lib/libdigikamgui.so.8.7.0)
digikam.facesengine: FaceClassifier::loadTrainingData: exception:  OpenCV(4.12.0) /usr/include/opencv4/opencv2/core/mat.inl.hpp:921: error: (-215:Assertion failed) (unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()) in function 'at'

qt.multimedia.ffmpeg: Using Qt multimedia with FFmpeg version n7.1.1 GPL version 3 or later
kf.xmlgui: Unhandled container to remove :  Digikam::DigikamApp
```

The output is exactly the same when I do not launch with prime, `command digikam`. But if digikam is not actually using my discrete GPU, I guess I wouldn't expect anything different anyway.
Comment 5 Chad B. 2025-07-14 18:15:51 UTC
I'm experiencing the same issue on Windows 10/11 as well. After performing "scan for faces" about 6000 images were identified in my library.  I identified and classified several hundred images, across about 20-30 unique people.  After performing this, I then ran the "Recognize Faces" which ran back thru the remaining ~5000 images that had faces identified and previously placed in the Unknown category.  It was stated that ZERO faces were recognized.  I selected to install all of the optional packages, and they all show as installed.  I'm not using any GPU for identification.  I've also rebuilt all training data to no avail.
Comment 6 Charlie Gorichanaz 2025-07-14 18:23:24 UTC
Created attachment 183235 [details]
digikam stdout/err log

Attached is the output of launching digikam and running a recognize faces only scan that finds around 300 faces but recognizes none.

export QT_LOGGING_RULES="digikam*=true"; digikam 2>&1 | tee digikam-cgorichanaz.txt
Comment 7 Maik Qualmann 2025-07-14 18:42:39 UTC
This message is strange, and you can find information about it online. Please disable OpenCL in digiKam and restart. Does face recognition work now?

[ WARN:0@16.736] global ocl4dnn_conv_spatial.cpp:1931 loadTunedConfig OpenCV(ocl4dnn): consider to specify kernel configuration cache directory through OPENCV_OCL4DNN_CONFIG_PATH parameter.

Maik
Comment 8 Charlie Gorichanaz 2025-07-14 19:10:56 UTC
I just tried unchecking the checkbox "Use OpenCL hardware acceleration" and re-scanned, still have the same result with no faces recognized. I also tried restarting digikam, ensuring the box was still unchecked, and same results.

Note that line with "OPENCV_OCL4DNN_CONFIG_PATH" no longer appears in my console log output with the box unchecked. But still I have no face recognition. Please let me know if I should provide the detailed logs again.
Comment 9 Maik Qualmann 2025-07-14 19:13:23 UTC
The training database probably needs to be rebuilt now as well.

Maik
Comment 10 Chad B. 2025-07-14 19:37:39 UTC
(In reply to Maik Qualmann from comment #9)
> The training database probably needs to be rebuilt now as well.
> 
> Maik

Does a separate bug need to be created for tracking on Windows as well?  OpenCL was never on for me on Windows, with external DB on Linux server, but no faces detected.
Comment 11 Charlie Gorichanaz 2025-07-14 19:47:14 UTC
I just finished rebuilding training DB with the openCV option disabled, but unfortunately the face scan still recognizes no faces of the 280 faces it said were detected. The output for that whole execution was 254748 lines, and seems to contain a lot of more personal data (full names of people in my DB, filenames, etc.).
Comment 12 Charlie Gorichanaz 2025-07-14 19:55:23 UTC
For good measure, I also ran a "Recognize faces only" with setting bumped down to 5 and selecting all albums + Unknown tag. That produced 0 recognized faces. My people sidebar says "Unknown (3192)", and when I click it, the main area shows "Unknown / 2,875 items". I assume that's because some images have multiple face tags of unknown. But anyway, I would expect some faces in there to be recognized, especially since many of them are my own face.
Comment 13 Maik Qualmann 2025-07-15 06:12:23 UTC
I also found this error message in your old log. Apparently, there was an exception while loading the training data. Is this message still appearing, right at the beginning of digiKam's startup?

digikam.facesengine: FaceClassifier::loadTrainingData: exception:  OpenCV(4.12.0) /usr/include/opencv4/opencv2/core/mat.inl.hpp:921: error: (-215:Assertion failed) (unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()) in function 'at'

Maik
Comment 14 Charlie Gorichanaz 2025-07-15 07:34:21 UTC
Hi Maik, yes, that exception does appear in every log I've saved while testing this, and is appearing for me currently when launching Digikam. Does that seem like something Digikam's causing or a problem in that package?

In case it helps, it looks like I've updated opencv package a few times in the last month. I could try testing an older version if you think it's relevant.

```
    40043  27924 -rw-r--r--   1 root     root     28591680 Jun 12 05:14 /var/cache/pacman/pkg/opencv-4.11.0-13-x86_64.pkg.tar.zst
    41040  27924 -rw-r--r--   1 root     root     28591764 Jun 25 23:06 /var/cache/pacman/pkg/opencv-4.11.0-14-x86_64.pkg.tar.zst
    41473  29384 -rw-r--r--   1 root     root     30085722 Jul  2 09:46 /var/cache/pacman/pkg/opencv-4.12.0-1-x86_64.pkg.tar.zst
```
Comment 15 caulier.gilles 2025-07-15 07:45:49 UTC
The new opencv version is out few days ago. We don't yet tested with this version, but i doubt that it's the problem.
At least if opencv is updated, digiKam must be recompiled of course. It's the case ?
Comment 16 Charlie Gorichanaz 2025-07-15 09:00:35 UTC
That's a good question... I almost never need to specifically deal with that on Arch somehow, aside from a few packages that depend on Python major versions in my experience. I don't recall watching anything compile when updating the digikam package. It does look like the Digikam package maintainer pushed an update to the PKGBUILD https://gitlab.archlinux.org/archlinux/packaging/packages/digikam specifically referencing opencv 4.12 a week ago at [upgpkg: 8.7.0-2: opencv 4.12 rebuild (0b3911b3) · Commits · Arch Linux / Packaging / Packages / digikam · GitLab](https://gitlab.archlinux.org/archlinux/packaging/packages/digikam/-/commit/0b3911b3f0465d35df5d276cd78ebdbb80a478ca) though I don't understand what actually changed with the package.
Comment 17 Maik Qualmann 2025-07-16 09:28:07 UTC
*** Bug 507101 has been marked as a duplicate of this bug. ***
Comment 18 Maik Qualmann 2025-07-16 16:31:22 UTC
Git commit afe5772bf982e95bdf312dd627031bf838564249 by Maik Qualmann.
Committed on 16/07/2025 at 16:29.
Pushed by mqualmann into branch 'master'.

try to fix exception with OpenCV-4.12
Related: bug 507101

M  +1    -1    core/libs/facesengine/recognition/faceclassifier.cpp

https://invent.kde.org/graphics/digikam/-/commit/afe5772bf982e95bdf312dd627031bf838564249
Comment 19 caulier.gilles 2025-07-19 20:05:08 UTC
The digiKam 8.8.0 pre-relelase AppImage have been rebuilt using last Qt 6.9.1,
OpenCV 4.12, and KDE framework 6.16.

https://files.kde.org/digikam/digiKam-8.8.0-20250719T191430-Qt6-x86-64.appimage.mirrorlist

Can you reproduce the problem with this version?

Best regards

Gilles Caulier
Comment 20 Charlie Gorichanaz 2025-07-19 20:44:15 UTC
Hadn't used an appimage before, that was pretty straightforward.

```
$ wget https://cdn.files.kde.org/digikam/digiKam-8.8.0-20250719T191430-Qt6-x86-64.appimage
$ chmod +x digiKam-8.8.0-20250719T191430-Qt6-x86-64.appimage
$ ./digiKam-8.8.0-20250719T191430-Qt6-x86-64.appimage
```
- I then ran the same face recognition process I tried before, and this time I indeed got a bunch of faces show up under the Unconfirmed tag!
- I also then checked "Use OpenCL hardware acceleration" and "Use OpenCL acceleration for AI models" and restarted the process, ran another scan of another folder, and it seems to be working correctly now.
- Next I launched my native Digikam installation to run another scan on a new folder to confirm that one did not magically start working due to any recent changes to my system. This added 150+ faces to the Unknown tag but did not change the Unconfirmed tag.
- Then I relaunched the new appimage, did a recognize only on that same section of my library, and this time it added 120 faces to Unconfirmed and the Unknown count went down by the same.

So it seems the appimage provided above works for me, while my native digikam install continues to not work.

Note in case it becomes relevant, for some reason I was not able to launch the appimage prepending the command with "prime-run" to get it to use my discrete GPU, but as mentioned before, I may have a misconfiguration on my end.