Bug 499156

Summary: YOLOv11 let digiKam crash
Product: [Applications] digikam Reporter: fuerallesg
Component: Maintenance-AutoTagsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles, metzpinguin, michael_miller
Priority: NOR    
Version First Reported In: 8.6.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 8.6.0
Sentry Crash Report:

Description fuerallesg 2025-01-26 13:09:21 UTC
SUMMARY
I like to use the auto tag function in the maintenance menu. Starting the process with one of the YOLOv11 models causes the digiKam to crash.

PS: I still have to find out again how to create a crash report. Update follows

STEPS TO REPRODUCE
1. Open maintenance tool and select an album
2. Activate auto tag and select one of the two YOLOv11 models
3. Start the processs

OBSERVED RESULT
The process starts and the progress bar shows 0%. After few seconds the whole digiKam instance crashes. (Probably before the first image is analyzed)

EXPECTED RESULT
The process starts and the progress bar reaches 100% with tagged images.

SOFTWARE/OS VERSIONS
Windows: 11

ADDITIONAL INFORMATION
Comment 1 fuerallesg 2025-01-26 16:44:16 UTC
I have started it twice as I thought the RAF file could be the problem but it is not. The second run begins at line 481:
https://drive.google.com/file/d/1sUxCg7i5LhvRMofTrKKcbU6B7FZGqODI/view
Comment 2 Maik Qualmann 2025-01-26 19:25:24 UTC
The DSCF0217.RAF file appears to be defective and cannot be loaded by Libraw.

Another issue is that the face training database is not updated correctly. It is best to delete the file "C:/Documents/digikam/recognition.db". This will be recreated and the training data can then be rebuilt.

Maik
Comment 3 fuerallesg 2025-01-26 21:39:05 UTC
Yes, the raw file is corrupted. That is why I tried the auto tag again with a different file.

Thanks for the tip. I deleted "recognition.db" and rebuilt my training data. 

Mik
Comment 4 Maik Qualmann 2025-01-27 11:57:36 UTC
This is the backtrace of the crash under Windows, I suspect access to an empty QList.

digikamgui.dll!Digikam::AutotagsClassifierYolo::predictMulti(const QList<cv::Mat> & targets) Zeile 137	C++	Symbole wurden geladen.
digikamgui.dll!Digikam::AutotagsPipelineObject::classifier() Zeile 459	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!std::invoke(bool(Digikam::MLPipelineFoundation::*)() &) Zeile 1745	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor::__l2::<lambda_1>::operator()(bool(Digikam::MLPipelineFoundation::*)() function, Digikam::MLPipelineFoundation *) Zeile 116	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!std::invoke(const QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor::__l2::<lambda_1> &) Zeile 1739	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!std::_Apply_impl(const QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor::__l2::<lambda_1> &) Zeile 1077	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!std::apply(const QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor::__l2::<lambda_1> &) Zeile 1088	C++	Symbole wurden geladen.
digikamcore.dll!QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor() Zeile 122	C++	Symbole wurden geladen.
digikamcore.dll!QtConcurrent::RunFunctionTaskBase<bool>::run() Zeile 83	C++	Symbole wurden geladen.

Maik
Comment 5 Michael Miller 2025-01-27 14:28:32 UTC
Git commit 309a48e2b374eb02ecf33b1c0ed99d030a92d40f by Michael Miller.
Committed on 27/01/2025 at 14:28.
Pushed by michmill into branch 'master'.

Fix YOLO classifier exception
FIXED-IN: 8.6.0

M  +8    -0    core/libs/tags/autoassignment/classifiers/multiclassyolo/autotagsclassifiermultiyolo.cpp

https://invent.kde.org/graphics/digikam/-/commit/309a48e2b374eb02ecf33b1c0ed99d030a92d40f
Comment 6 Maik Qualmann 2025-01-29 16:22:41 UTC
The crash is still reproducible. I'm making a new backtrace.

Maik
Comment 7 Maik Qualmann 2025-01-29 16:33:57 UTC
New Backtrace:

digikamgui.dll!`anonymous namespace'::__std_minmax_element_impl<2,`anonymous namespace'::_Minmax_traits_f_avx>(const void * _First=0x00000259e3651090, const void * const _Last=0x00000259e36511d0, const bool _Sign=false) Zeile 1775	C++	Symbole wurden geladen.
[Inlineframe] digikamgui.dll!std::_Max_element_unchecked(float * _Last, float *) Zeile 6845	C++	Symbole wurden geladen.
[Inlineframe] digikamgui.dll!std::max_element(float *) Zeile 6870	C++	Symbole wurden geladen.
[Inlineframe] digikamgui.dll!std::max_element(float * _Last, float *) Zeile 6877	C++	Symbole wurden geladen.
digikamgui.dll!Digikam::AutotagsClassifierYolo::predictMulti(const QList<cv::Mat> & targets) Zeile 145	C++	Symbole wurden geladen.
digikamgui.dll!Digikam::AutotagsPipelineObject::classifier() Zeile 459	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!std::invoke(bool(Digikam::MLPipelineFoundation::*)() &) Zeile 1711	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor::__l2::<lambda_1>::operator()(bool(Digikam::MLPipelineFoundation::*)() function, Digikam::MLPipelineFoundation *) Zeile 116	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!std::invoke(const QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor::__l2::<lambda_1> &) Zeile 1705	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!std::_Apply_impl(const QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor::__l2::<lambda_1> &) Zeile 1064	C++	Symbole wurden geladen.
[Inlineframe] digikamcore.dll!std::apply(const QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor::__l2::<lambda_1> &) Zeile 1075	C++	Symbole wurden geladen.
digikamcore.dll!QtConcurrent::StoredFunctionCall<bool (__cdecl Digikam::MLPipelineFoundation::*)(void),Digikam::MLPipelineFoundation *>::runFunctor() Zeile 122	C++	Symbole wurden geladen.
digikamcore.dll!QtConcurrent::RunFunctionTaskBase<bool>::run() Zeile 83	C++	Symbole wurden geladen.

Maik
Comment 8 Michael Miller 2025-01-31 15:23:12 UTC
Hi everyone,
I'm still working on building a new Windows dev machine.  I'm hoping to be able to debug this over the weekend.

Cheers,
Mike
Comment 9 Michael Miller 2025-02-05 01:54:49 UTC
Git commit a163ae4e5f912600e09887f86403adedc5b1a436 by Michael Miller.
Committed on 05/02/2025 at 01:54.
Pushed by michmill into branch 'master'.

fix YOLO in Windows
FIXED-IN: 8.6.0

M  +5    -5    core/libs/tags/autoassignment/classifiers/multiclassyolo/autotagsclassifiermultiyolo.cpp

https://invent.kde.org/graphics/digikam/-/commit/a163ae4e5f912600e09887f86403adedc5b1a436