Bug 460570 - Face Recognition fails (process stuck at 0%)
Summary: Face Recognition fails (process stuck at 0%)
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Engine (other bugs)
Version First Reported In: 7.8.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks: 472452
  Show dependency treegraph
 
Reported: 2022-10-17 07:19 UTC by eject88
Modified: 2023-07-21 03:36 UTC (History)
7 users (show)

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


Attachments
Log from crash report Windows 10 (113.38 KB, text/plain)
2022-10-17 08:09 UTC, eject88
Details

Note You need to log in before you can comment on or make changes to this bug.
Description eject88 2022-10-17 07:19:44 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
Selecting People module and performing a scan on selected directories/Albums on an external drive, process remains at 0% showing only some results in Unknown People tab.  External drive then switches its light off (meaning that there is no request for data from it) and process still remains at 0% on digikam.  At the same time the laptop remains relatively cool meaning that there is no high demanding process running actually on it (such as face detection).

Reproduced in two different by gen laptops (Lenovo X1 Carbon gen2 and gen3 respectivelly) with the same external drive used.

STEPS TO REPRODUCE
1. Workflow tab: Skip images already scanned
Detect faces
Search in tab: 5 Albums selected
Settings tab: Use YOLO v3 detection model (not selected/unchecked)
Work on all processor cores (selected/checked)
2. External drive connected to laptop with those 5 Albums selected from
3. Irelevant: Settings: Miscellaneous - System - Disable hardware acceleration OpenCL (checked or unchecked with restart makes no difference)
4. 

OBSERVED RESULT
Process is stuck with message on screen "Updating faces data base" 0%
No activity on external disk
Laptop remains relatively cool for such a cpu demanting process.
No results in People-Unknown (or other) tab except from few findings wich might even not be from those directories selected.

EXPECTED RESULT
In People-Unkown tab should expect results from all the directories in a discent amount of time with the bar and percentage moving from 0% to 100%.  From there and as the Detect faces was selectted for this bug report, one could tag enough faces so for the Recognise faces to take part afterwards as a second step/scan.

SOFTWARE/OS VERSIONS
Windows: Windows 10 Version 2009 (x86_64)
macOS: nan
Linux/KDE Plasma: nan
(available in About System)
KDE Plasma Version: nan
KDE Frameworks Version: nan
Qt Version: nan

ADDITIONAL INFORMATION
Comment 1 Maik Qualmann 2022-10-17 07:29:47 UTC
Download DebugView from Microsoft and enable internal debugging in the digiKam settings under Miscellaneous-> System. Start DebugView and restart digiKam. Post the output from DebugView after no further progress on face recognition.

Maik
Comment 2 eject88 2022-10-17 08:09:49 UTC
Created attachment 152922 [details]
Log from crash report Windows 10
Comment 3 Maik Qualmann 2022-10-17 11:21:51 UTC
Ok , 5 images loaded but the face engine won't start. I suspect a race condition, I also observed this problem a long time ago.
Lately, the problem hadn't occurred here anymore. I will look at it.
It should work if you expand the progress bar and press the cancel button on the right and start it again.

Maik
Comment 4 eject88 2022-10-17 11:33:04 UTC
(In reply to Maik Qualmann from comment #3)
> Ok , 5 images loaded but the face engine won't start. I suspect a race
> condition, I also observed this problem a long time ago.
> Lately, the problem hadn't occurred here anymore. I will look at it.
> It should work if you expand the progress bar and press the cancel button on
> the right and start it again.
> 
> Maik

Thank you very much!! Please ask me of any other testing or o/p you need as a feed for this matter.  I will be glad to help.
Comment 5 eject88 2022-10-18 10:22:06 UTC
(In reply to Maik Qualmann from comment #3)
> Ok , 5 images loaded but the face engine won't start. I suspect a race
> condition, I also observed this problem a long time ago.
I have just realized it.  Would it help if I run this process only on one core?  I know that multithreading is not bound to that but it might solve the problem for now...  Currently I have set to work on all cores.

> Lately, the problem hadn't occurred here anymore. I will look at it.
> It should work if you expand the progress bar and press the cancel button on
> the right and start it again.
I did try this and waited for a long time, yet the application stopped responding eventually and had to force close it.
Comment 6 elena 2022-12-29 22:43:59 UTC
I have similar problem. cancel button doesnt work either.
Comment 7 Maik Qualmann 2023-01-31 10:54:39 UTC
*** Bug 465078 has been marked as a duplicate of this bug. ***
Comment 8 Maik Qualmann 2023-01-31 11:33:43 UTC
Git commit bc9bb35ae2dd94e92e440dad95128898593bfe91 by Maik Qualmann.
Committed on 31/01/2023 at 11:32.
Pushed by mqualmann into branch 'qt5-maintenance'.

try to fix race condition in the face engine with process events

M  +1    -0    core/utilities/facemanagement/threads/facepipeline_p.h
M  +2    -0    core/utilities/facemanagement/threads/facepreviewloader.cpp

https://invent.kde.org/graphics/digikam/commit/bc9bb35ae2dd94e92e440dad95128898593bfe91
Comment 9 Maik Qualmann 2023-02-03 21:27:14 UTC
Can you please test the upcoming digiKam-7.10.0 if the problem can still be reproduced:

https://files.kde.org/digikam/

Maik
Comment 10 eject88 2023-02-04 11:13:09 UTC
(In reply to Maik Qualmann from comment #9)
> Can you please test the upcoming digiKam-7.10.0 if the problem can still be
> reproduced:
> 
> https://files.kde.org/digikam/
> 
> Maik

Hello Maik,

unfortunately I have switched to linux on the same laptop that I did my tests.  I do hold another one with windows that I could try on that.  It will not be though till  13.1.23 and onwards that I will have access to it.
Comment 11 Ian Davey 2023-02-07 16:58:18 UTC
As requested I have installed 7.10.0, selected People module, Skip images already scanned. Unfortunately process remains at 0%.
Comment 12 Maik Qualmann 2023-02-07 20:01:28 UTC
Ok, thanks for the feedback. Is the problem only reproducible with activated YOLO Engine?

Maik
Comment 13 Maik Qualmann 2023-02-07 20:55:09 UTC
*** Bug 465434 has been marked as a duplicate of this bug. ***
Comment 14 Maik Qualmann 2023-02-08 20:46:52 UTC
Git commit f1e97676427c8850f8d875cd5dc9bc620ea7fa66 by Maik Qualmann.
Committed on 08/02/2023 at 20:45.
Pushed by mqualmann into branch 'master'.

remove mix of FacePipelineExtendedPackage::Ptr is used as reference

M  +2    -2    core/utilities/facemanagement/threads/facepipeline_p.cpp
M  +2    -2    core/utilities/facemanagement/threads/facepipeline_p.h
M  +1    -1    core/utilities/facemanagement/threads/parallelpipes.cpp
M  +1    -1    core/utilities/facemanagement/threads/parallelpipes.h

https://invent.kde.org/graphics/digikam/commit/f1e97676427c8850f8d875cd5dc9bc620ea7fa66
Comment 15 Jon 2023-02-27 19:04:39 UTC
I'm experiencing this same issue. I think it's due to the first run of detect faces using multiple cpu cores. If I do a first run with 1 core, then the subsequent runs with multiple cores works. I think this has to happen after every startup of the digikam.

My simple repro:
1. Open digikam
2. Detect faces with multiple cpu cores ENABLED
3. Progress hung at 0%
4. App is hung, so kill app.

Workaround:
1. Open digikam
2. Detect faces on a small album with multiple cpu cores DISABLED
3. ENABLE multiple cpu cores
4. Detect faces on a large album
Comment 16 Ian Davey 2023-03-20 11:55:37 UTC
My issue has been resolved.