Bug 493914 - OpenCV assertion failure when tagging face without models installed
Summary: OpenCV assertion failure when tagging face without models installed
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Workflow (show other bugs)
Version: 8.5.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-01 11:35 UTC by Jonathan Coates
Modified: 2024-10-07 05:57 UTC (History)
2 users (show)

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


Attachments
gdb backtrace of crash (6.81 KB, text/plain)
2024-10-01 11:35 UTC, Jonathan Coates
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Coates 2024-10-01 11:35:36 UTC
Created attachment 174265 [details]
gdb backtrace of crash

SUMMARY
When attempting to mark a face, digikam crashes due to an assertion error in opencv-dnn/kd_node.c.

STEPS TO REPRODUCE
1. Create a fresh digikam installation.
2. When prompted to install the additional models, uncheck all boxes and close the window.[^1]
3. Open a photo and draw a rectangle.
4. Enter a name, and press enter.
5. Crash

[^1]: This wasn't intentional. I was having issues downloading the larger files within digikam (just gives a connection closed). I've since downloaded them manually, and can confirm this resolves the issue.

OBSERVED RESULT
I see the following in the journal output

digikam.facedb: fail to insert face embedding, last query "INSERT INTO FaceMatrices (identity, `context`, embedding) VALUES (?,?,?);" bound values QList(QVariant(int, 1), QVariant(QString, "
digikam"), QVariant(QByteArray, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00""2\xEE\xC7\xFF+\xEE\xC7\xFF\x1F\xEE\xC7\xFF\x13\xEE\xC7\xFF\x07\xEE\xC7\xFF\xFB\xED\xC7\xFF\xEF\xED\xC7\xFF\xE3\xED\xC7\xFF""9QRunnable\x00\x00\x00\x00\x
00\x00N9QRunnable16QGenericRunnableE\x00QSizeF\x00QSize\x00QLineF\x00QLine\x00QRectF\x00QRect\x00\x00\x00QPointF\x00QPoint\x00QUuid\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\f\r\x0E\x0F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x
FF\xFF\xFF\xFF\xFF\xFF\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 sse2\x00 sse
3\x00 ssse3\x00 fma\x00 sse4.1\x00 sse4.2\x00 movbe\x00 popcnt\x00 aes\x00 avx\x00 f16c\x00 rdrnd\x00 bmi\x00 avx2\x00 bmi2\x00 avx512f\x00 avx512dq\x00 rdseed\x00 avx512ifma\x00 avx512cd\x00 sha\x00 avx512bw\x00 avx512vl\x00 avx512vbm
i\x00 waitpkg\x00 avx512vbmi2\x00 shstk\x00 gfni\x00 vaes\x00 avx512bitalg\x00 avx512vpopcntdq\x00 hybrid\x00 ibt\x00 avx512fp1")) QSqlError("1299", "Unable to fetch row", "NOT NULL constraint failed: FaceMatrices.embedding")
digikam.facedb: error inserting face embedding to database
ASSERT: "(nodePos.rows == 1) && (nodePos.cols == dimension) && (nodePos.type() == CV_32F)" in file /usr/src/debug/digikam/digikam-8.4.0/core/libs/facesengine/recognition/opencv-dnn/kd_node.cpp, line 116

I've also attached the full backtrace.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux 6.10.10 (Arch), Wayland
KDE Plasma Version: N/A. I'm running Gnome 47. Sorry!
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.3-1

ADDITIONAL INFORMATION
Comment 1 Maik Qualmann 2024-10-01 14:33:48 UTC
This isn't actually a crash, just an abort caused by a Q_ASSERT. I had actually tested everything for non-existent models, but since I don't compile digiKam with debug, the Q_ASSERT wasn't executed. I'll fix it.

Maik
Comment 2 Maik Qualmann 2024-10-01 18:07:23 UTC
Git commit 75fd0319cb3beafd419b5cc02dcc287ddf0a043c by Maik Qualmann.
Committed on 01/10/2024 at 18:06.
Pushed by mqualmann into branch 'master'.

fix crash if face recognition model data was not loaded

M  +1    -1    NEWS
M  +8    -1    core/libs/facesengine/recognition/opencv-dnn/opencvdnnfacerecognizer_p.h

https://invent.kde.org/graphics/digikam/-/commit/75fd0319cb3beafd419b5cc02dcc287ddf0a043c
Comment 3 Jonathan Coates 2024-10-02 17:52:21 UTC
Thank you so much for the fix!