Bug 337507 - Face Detection gives no results, no matter the accuracy setting
Summary: Face Detection gives no results, no matter the accuracy setting
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Detection (show other bugs)
Version: 4.1.0
Platform: Debian unstable Linux
: NOR major
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-16 17:31 UTC by Am.Tresen
Modified: 2017-07-26 17:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.4.0


Attachments
Screenshot of folder content (89.79 KB, image/png)
2014-07-16 22:03 UTC, Am.Tresen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Am.Tresen 2014-07-16 17:31:04 UTC
Face Detection does not work at all for me, every time I run the detection the following happens:

Digikam starts scanning the files, this is gonna take about 13 seconds for 101 pictures. While it is scanning, nothing shows up apart from the progress bar.

The settings I use are: Detect faces; rescan and merge results; search by tag->"any tag"; accuracy 80; use all processor kernels.

This is reproducable with pretty much any settings, I already tried searching ALL collections and ALL tags, set accuracy to 80, 50, 20, tried using only one kernel (which somehow results in the same speed).

I also tried to mark 1 face manually and rescanned hoping it would at least detect that face then, but it didnt.

Reproducible: Always

Steps to Reproduce:
1. Start scanning for faces (face detection).
2. Wait for results.
3. Nothing happens!
Actual Results:  
Basically no actual results apart from a progress bar appearing.

Expected Results:  
I would expect a LOT of face markers to show up in my collections.

I have no idea how to give additional information, since I'm a linux newbie. If anyone could give me instructions I will provide further info.
Comment 1 caulier.gilles 2014-07-16 18:32:44 UTC
Look this comment here :

https://www.digikam.org/node/714#comment-20767
Comment 2 Am.Tresen 2014-07-16 19:33:16 UTC
(In reply to Gilles Caulier from comment #1)
> Look this comment here :
> 
> https://www.digikam.org/node/714#comment-20767



This is what debug gave out for me:

digikam(6660)/KFACE KFaceIface::FaceDetector::Private::backend: OpenCV Haar Cascades dir found at ()
digikam(6660)/KFACE: OpenCV Haar Cascade director cannot be found. Did you install OpenCV XML data files?

I guess the problem is that the Cascades directory isnt found. It is at /usr/share/opencv/haarcascades though, and i downloaded all the XML files from the website you specified. Is there any workaround for this, like specifying the directory for OpenCV or something?

Thanks in advance,

Tresen
Comment 3 caulier.gilles 2014-07-16 21:06:16 UTC
No place files here :

[root@localhost haarcascades]# pwd
/usr/share/apps/libkface/haarcascades
[root@localhost haarcascades]# ls -al
total 11984
drwxr-xr-x 2 root root    4096 juin  23 14:12 ./
drwxr-xr-x 5 root root    4096 mars   4 15:29 ../
-rw-r--r-- 1 root root  837462 juin  18 15:05 haarcascade_frontalface_alt2.xml
-rw-r--r-- 1 root root 3644763 juin  18 15:05 haarcascade_frontalface_alt_tree.xml
-rw-r--r-- 1 root root  919871 juin  18 15:05 haarcascade_frontalface_alt.xml
-rw-r--r-- 1 root root 1254733 juin  18 15:05 haarcascade_frontalface_default.xml
-rw-r--r-- 1 root root  777721 juin  18 15:05 haarcascade_mcs_lefteye.xml
-rw-r--r-- 1 root root  719806 juin  18 15:05 haarcascade_mcs_mouth.xml
-rw-r--r-- 1 root root 1585210 juin  18 15:05 haarcascade_mcs_nose.xml
-rw-r--r-- 1 root root 1383113 juin  18 15:05 haarcascade_mcs_righteye.xml
-rw-r--r-- 1 root root 1125633 juin  18 15:05 haarcascade_profileface.xml
[root@localhost haarcascades]#
Comment 4 Am.Tresen 2014-07-16 22:03:36 UTC
Created attachment 87765 [details]
Screenshot of folder content
Comment 5 Am.Tresen 2014-07-16 22:03:47 UTC
Thanks for all your info, but it sadly still doesn't work. I've copied the haarcascades directory to

/usr/share/apps/libkface/
/home/sebastian/libkface/ (this is the only libkface directory I have it seems. Strange place, isn't it?)
and finally
/home/sebastian/libkface/libkface
/home/sebastian/libkface/libkface/detection

Neither of these worked. All the directories already existed (not containing the haarcascades folder), except for the one you specified (the first one). Error message is identical for each of the tries. I've attached a picture of what the folder content looks like, but it seems complete to me.
Comment 6 Am.Tresen 2014-07-16 22:09:10 UTC
Do I have to run the git in a specific directory for this link you provided? 

https://projects.kde.org/projects/extragear/libs/libkface/repository/revisions/master/show/data
Comment 7 Am.Tresen 2014-07-17 04:28:17 UTC
Okay, I managed to make it work. I needed to copy the xml files into the following directory:

/home/YOURUSERNAME/.kde/share/apps/libkface/haarcascades/

Thanks for the support :-)
Comment 8 Am.Tresen 2014-07-17 04:28:53 UTC
(In reply to Am.Tresen from comment #7)
> Okay, I managed to make it work. I needed to copy the xml files into the
> following directory:
> 
> /home/YOURUSERNAME/.kde/share/apps/libkface/haarcascades/
> 
> Thanks for the support :-)

To add this: This was for Debian Sid.
Comment 9 caulier.gilles 2014-07-17 21:33:56 UTC
Following explanations given on digiKam.org here :

https://www.digikam.org/node/714#comment-20767

It most relevant of DOWNSTREAM problem about libkface used to compile digiKam under Debian...

Gilles Caulier
Comment 10 caulier.gilles 2014-07-19 08:52:56 UTC
Git commit 488a97a8c8db3da7875b6cb0dba55b7a8314e9b9 by Gilles Caulier.
Committed on 19/07/2014 at 08:51.
Pushed by cgilles into branch 'master'.

add OPenCV cmake Install path in list of paths to search shared Haar Cascade files

M  +3    -1    libkface/CMakeLists.txt
M  +6    -3    libkface/facedetector.cpp
R  +3    -0    libkface/libopencv.h.cmake.in [from: libkface/libopencv.h - 095% similarity]
M  +1    -0    tests/CMakeLists.txt

http://commits.kde.org/libkface/488a97a8c8db3da7875b6cb0dba55b7a8314e9b9
Comment 11 Pino Toscano 2014-09-29 22:21:51 UTC
Gilles,

actually, when some months ago I implemented in libkface the way to use the system versions of the XML files for the haar cascades, it was working fine.
Then, recently, you broke it:
http://commits.kde.org/libkface/b8a9b3f23f073e899cede16c351ca9119d8af510
you renamed the system directory from "opencv" to "OpenCV", thus no more finding the files, at least on Debian (where they are installed under /usr/share/opencv/).

I'm going to add also the old path back, so please do *not* remove it, to not break this feature again, thanks.
Comment 12 Pino Toscano 2014-09-29 22:23:47 UTC
Git commit 4433a5ba8386641088fe0d606f8b18fd0e87e973 by Pino Toscano.
Committed on 29/09/2014 at 22:22.
Pushed by pino into branch 'master'.

Restore the lowercase path to opencv shared data

Add back the lowercase path to the OpenCV data (e.g. the haar cascades),
as it was before commit b8a9b3f23f073e899cede16c351ca9119d8af510.

This makes likface able to use again system OpenCV data, at least on
Debian systems.

M  +2    -0    libkface/facedetector.cpp

http://commits.kde.org/libkface/4433a5ba8386641088fe0d606f8b18fd0e87e973
Comment 13 caulier.gilles 2014-09-30 05:25:56 UTC
Thanks Pino to test back under Debian. I don't take a care about this possible case with Haar cascade files path.

Gilles Caulier
Comment 14 Pino Toscano 2014-09-30 05:51:04 UTC
(In reply to Gilles Caulier from comment #13)
> I don't take a care about this possible case with Haar cascade files path.

Then please do not break it for no reason, thanks.