libkface

classic Classic list List threaded Threaded
37 messages Options
12
Reply | Threaded
Open this post in threaded view
|

libkface

Tobias Leupold
Hi list!

I hope I can find some help here. I'm working on face detection and face
recognition for KPhotoAlbum via libkface.

Implementing face detection was quite easy and does work nicely; I just had to
take a look at the test/detect.cpp demo and simply did it alike. So I thought
that the recognition feature could be implemented (of course not so but still)
easy as well.

But alas, I'm having big trouble with face recognition. I wanted to start
playing around with the test/recognize.cpp demo before implementing something.

Training the database with a few faces was fast and the recognition also
worked somewhat on my test faces. But the time needed to train the database
grew exponentially (according to a plot I made of the times using R). The
first faces had been learned in less than a second. The 11th face took over 10
minutes to learn already, accompanied by heavy HD use and my system even
swapping. The time the recognition took also grew exponentially with the
number of trained faces.

I'm pretty sure that this is not the correct way to use libkface for face
recognition, as this would be simply unusable if I tried to add a lot of
different people.

Unfortunately, I wasn't able to find some "working" demo or documentation
about how to use libkface for face recognition. I had a look at the Digikam
sources, but this is (of course) quite complicated code, so it's hard to get
how it's done there.

Are there some docs I can read? I would really appreciate any help.

Thanks in advance!

Yours, Tobias
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Marcel Wiesweg

>
> Unfortunately, I wasn't able to find some "working" demo or documentation
> about how to use libkface for face recognition. I had a look at the Digikam
> sources, but this is (of course) quite complicated code, so it's hard to get
> how it's done there.
>
> Are there some docs I can read? I would really appreciate any help.

There are no more docs than the API docs in the header files. Recognition is a
moving target, we have some bugs in digikam here as well.

But even if we are unsure about the quality of recognition that is currently
available, there's certainly some easier problem, learning is usually pretty
fast and, IIRC, of  O(1) complexity.

Is your code in git somewhere?

Marcel


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Tobias Leupold
The face detection part I added to the KPA code can be found on
https://github.com/l3u/kphotoalbum/commit/04f6a995237d21990e25d282c78f15abab6d3106
But this was no problem and was "simply working".

The problems I had -- the exponential processing time growth and the massive
HD usage -- appeared when I used the "recognize.cpp" program from the libkface
sources (located in "test/"). I simply did some "./recognize train Name
image.jpg", and, as said, I got massive performance problems with more than
about 10 training images (each time, only the face part of the image was used,
as detected by the routine from my above code, that does the same thing as the
"recognize.cpp" program from "test/").

So I didn't write recognition code yet ...

Tobias

> There are no more docs than the API docs in the header files. Recognition is
> a moving target, we have some bugs in digikam here as well.
>
> But even if we are unsure about the quality of recognition that is currently
> available, there's certainly some easier problem, learning is usually
> pretty fast and, IIRC, of  O(1) complexity.
>
> Is your code in git somewhere?
>
> Marcel

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Gilles Caulier-4
Can you run Recognize tool into valgrind to see if memory leak is detected ?

Do you use last code from libkface that is review a lots recently,
which use revision number 3.1.0 ?

best

Gilles caulier

2014-06-23 1:00 GMT+02:00 Tobias Leupold <[hidden email]>:

> The face detection part I added to the KPA code can be found on
> https://github.com/l3u/kphotoalbum/commit/04f6a995237d21990e25d282c78f15abab6d3106
> But this was no problem and was "simply working".
>
> The problems I had -- the exponential processing time growth and the massive
> HD usage -- appeared when I used the "recognize.cpp" program from the libkface
> sources (located in "test/"). I simply did some "./recognize train Name
> image.jpg", and, as said, I got massive performance problems with more than
> about 10 training images (each time, only the face part of the image was used,
> as detected by the routine from my above code, that does the same thing as the
> "recognize.cpp" program from "test/").
>
> So I didn't write recognition code yet ...
>
> Tobias
>
>> There are no more docs than the API docs in the header files. Recognition is
>> a moving target, we have some bugs in digikam here as well.
>>
>> But even if we are unsure about the quality of recognition that is currently
>> available, there's certainly some easier problem, learning is usually
>> pretty fast and, IIRC, of  O(1) complexity.
>>
>> Is your code in git somewhere?
>>
>> Marcel
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Gilles Caulier-4
Tobias,

Following a recent private discussion between Marcel and me about
libkface, I resumed important details in DESIGN file just push in
git/master.

Take a look here and comment please :

https://projects.kde.org/projects/extragear/libs/libkface/repository/revisions/master/entry/DESIGN

Best

Gilles Caulier

2014-06-23 6:00 GMT+02:00 Gilles Caulier <[hidden email]>:

> Can you run Recognize tool into valgrind to see if memory leak is detected ?
>
> Do you use last code from libkface that is review a lots recently,
> which use revision number 3.1.0 ?
>
> best
>
> Gilles caulier
>
> 2014-06-23 1:00 GMT+02:00 Tobias Leupold <[hidden email]>:
>> The face detection part I added to the KPA code can be found on
>> https://github.com/l3u/kphotoalbum/commit/04f6a995237d21990e25d282c78f15abab6d3106
>> But this was no problem and was "simply working".
>>
>> The problems I had -- the exponential processing time growth and the massive
>> HD usage -- appeared when I used the "recognize.cpp" program from the libkface
>> sources (located in "test/"). I simply did some "./recognize train Name
>> image.jpg", and, as said, I got massive performance problems with more than
>> about 10 training images (each time, only the face part of the image was used,
>> as detected by the routine from my above code, that does the same thing as the
>> "recognize.cpp" program from "test/").
>>
>> So I didn't write recognition code yet ...
>>
>> Tobias
>>
>>> There are no more docs than the API docs in the header files. Recognition is
>>> a moving target, we have some bugs in digikam here as well.
>>>
>>> But even if we are unsure about the quality of recognition that is currently
>>> available, there's certainly some easier problem, learning is usually
>>> pretty fast and, IIRC, of  O(1) complexity.
>>>
>>> Is your code in git somewhere?
>>>
>>> Marcel
>>
>> _______________________________________________
>> Digikam-devel mailing list
>> [hidden email]
>> https://mail.kde.org/mailman/listinfo/digikam-devel
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Tobias Leupold
Hello Gilles,

Thanks, this helps!

Yours, Tobias

Am Dienstag 24 Juni 2014, 23:13:00 schrieb Gilles Caulier:

> Tobias,
>
> Following a recent private discussion between Marcel and me about
> libkface, I resumed important details in DESIGN file just push in
> git/master.
>
> Take a look here and comment please :
>
> https://projects.kde.org/projects/extragear/libs/libkface/repository/revisio
> ns/master/entry/DESIGN
>
> Best
>
> Gilles Caulier

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Tobias Leupold
In reply to this post by Gilles Caulier-4
Gilles,

I have a few comments on
https://projects.kde.org/projects/extragear/libs/libkface/repository/revisions/master/entry/DESIGN

> Faces database file is hosted in home directory to be shared with all
> applications which use libkface :

I don't think that's always the case; at least the recognize program in test/
does not use this path, but the current work dir to store the db.

And speaking generally of test/:

The recognize tool works fine. As said, I was able to implement face detection
using libkface with a few lines of code after having had a look at the
sources.

But I had to change all calls of kDebug() to qDebug(); kDebug() didn't produce
any output here (im very new to programming C++/Qt/KDE, so perhaps, this is my
fault; but it's quite confusing if the program doesn't speak). Same for the
recognize program.

> KFaceGui is a simple application able to run detection and recognition
> without to use CLI. Currently detection is implemented and recognition is
> broken.

The GUI in test/gui/ is (in contrast to the code in test/) not compiled when
building libkface. I think it would be nice if at least a README would be
placed here with how to do it. It would also ne nice if recognition was fixed
here, so that on has an example of how to do it.

And ... what's the general state of the library? When I tried to use it, I
thought it's ready-to-use ...

The face detection works fine, but does it work better than using OpenCV's
CascadeClassifier directly (cf. the small Python program I posted in
https://bugs.kde.org/show_bug.cgi?id=292900 )? Where's the difference? I think
this should be documented, as you surely put some effort into this, and
there's some good reason to use libkface.

And what about the recognition feature? Just speaking for me, I wasn't able to
use it yet. What about the align and preprocess tools? What do I have to do to
be able to use it?

I thought of the library like "give it some faces to learn" and "give it the
face part of a photo, get a person suggestion". Is this "high-level" access
possible? It would be really fine if the library cared about alignment and
preprocessing so nothing can go wrong.

I would really like to use it or even contribute to this library. There's
surely a need for a good OSS face detection and recognition tool. I think
everything would be way easier if all that was documented somewhere. Like some
"This is what we have right now and this is what we can do with it". With some
minimalistic clear and working example code.

At the moment, apart from the detection feature, It's quite hard to know
what's going on and how to use it ...

Yours, Tobias
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Gilles Caulier-4
2014-06-25 13:50 GMT+02:00 Tobias Leupold <[hidden email]>:

> Gilles,
>
> I have a few comments on
> https://projects.kde.org/projects/extragear/libs/libkface/repository/revisions/master/entry/DESIGN
>
>> Faces database file is hosted in home directory to be shared with all
>> applications which use libkface :
>
> I don't think that's always the case; at least the recognize program in test/
> does not use this path, but the current work dir to store the db.

absolutely. An improvement can be to add a new CLI argument to adjust
database path.

>
> And speaking generally of test/:
>
> The recognize tool works fine. As said, I was able to implement face detection
> using libkface with a few lines of code after having had a look at the
> sources.
>
> But I had to change all calls of kDebug() to qDebug(); kDebug() didn't produce
> any output here (im very new to programming C++/Qt/KDE, so perhaps, this is my
> fault; but it's quite confusing if the program doesn't speak). Same for the
> recognize program.

run kdebugdialog and turn on KFace debug space to print trace on the
console. No need to use qDebug() instead

>
>> KFaceGui is a simple application able to run detection and recognition
>> without to use CLI. Currently detection is implemented and recognition is
>> broken.
>
> The GUI in test/gui/ is (in contrast to the code in test/) not compiled when
> building libkface. I think it would be nice if at least a README would be
> placed here with how to do it. It would also ne nice if recognition was fixed
> here, so that on has an example of how to do it.

It compile if you turn on -DKDE4_BUILD_TESTS=ON cmake flag at
configuration time.

>
> And ... what's the general state of the library? When I tried to use it, I
> thought it's ready-to-use ...

i pass a lots of time to review code in library since few weeks and i
can said that implementation is better now (git/master). Crashes are
now fixed, but it still memory leak with database (Qt4-sqlite plugin
relevant).

>
> The face detection works fine, but does it work better than using OpenCV's
> CascadeClassifier directly (cf. the small Python program I posted in
> https://bugs.kde.org/show_bug.cgi?id=292900 )? Where's the difference? I think
> this should be documented, as you surely put some effort into this, and
> there's some good reason to use libkface.

No idea, never tested. perhaps Marcel can respond better than me here.
He has large experience about libkface as he has follow students who
work on it in the past.

In all case FaceDetection give excelent results with digiKam. Over
20000 face detected, only few are false (around 30-40)

>
> And what about the recognition feature? Just speaking for me, I wasn't able to
> use it yet. What about the align and preprocess tools? What do I have to do to
> be able to use it?

No idea. Process work but i seen only few real recognition here.

>
> I thought of the library like "give it some faces to learn" and "give it the
> face part of a photo, get a person suggestion". Is this "high-level" access
> possible? It would be really fine if the library cared about alignment and
> preprocessing so nothing can go wrong.

Here Marcel can respond better than me.

>
> I would really like to use it or even contribute to this library. There's
> surely a need for a good OSS face detection and recognition tool. I think
> everything would be way easier if all that was documented somewhere. Like some
> "This is what we have right now and this is what we can do with it". With some
> minimalistic clear and working example code.

Yes, please help is welcome. As API doc improvements, CLI test tool
(for ex recognition part of KFaceGUI need to be ported on new libkface
API)

Don't hesitate to contribute, it will be welcome...

Gilles Caulier

>
> At the moment, apart from the detection feature, It's quite hard to know
> what's going on and how to use it ...
>
> Yours, Tobias
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Gilles Caulier-4
Tobias,

With my commit http://commits.kde.org/libkface/dc0ac7b44c11a798543de7515ccc49190ea03086

I restored Recognition feature in KFaceGUI test program. Take a look,
in fact it simple to handle.

It miss again training feature to update database.

Gilles Caulier

2014-06-25 14:40 GMT+02:00 Gilles Caulier <[hidden email]>:

> 2014-06-25 13:50 GMT+02:00 Tobias Leupold <[hidden email]>:
>> Gilles,
>>
>> I have a few comments on
>> https://projects.kde.org/projects/extragear/libs/libkface/repository/revisions/master/entry/DESIGN
>>
>>> Faces database file is hosted in home directory to be shared with all
>>> applications which use libkface :
>>
>> I don't think that's always the case; at least the recognize program in test/
>> does not use this path, but the current work dir to store the db.
>
> absolutely. An improvement can be to add a new CLI argument to adjust
> database path.
>
>>
>> And speaking generally of test/:
>>
>> The recognize tool works fine. As said, I was able to implement face detection
>> using libkface with a few lines of code after having had a look at the
>> sources.
>>
>> But I had to change all calls of kDebug() to qDebug(); kDebug() didn't produce
>> any output here (im very new to programming C++/Qt/KDE, so perhaps, this is my
>> fault; but it's quite confusing if the program doesn't speak). Same for the
>> recognize program.
>
> run kdebugdialog and turn on KFace debug space to print trace on the
> console. No need to use qDebug() instead
>
>>
>>> KFaceGui is a simple application able to run detection and recognition
>>> without to use CLI. Currently detection is implemented and recognition is
>>> broken.
>>
>> The GUI in test/gui/ is (in contrast to the code in test/) not compiled when
>> building libkface. I think it would be nice if at least a README would be
>> placed here with how to do it. It would also ne nice if recognition was fixed
>> here, so that on has an example of how to do it.
>
> It compile if you turn on -DKDE4_BUILD_TESTS=ON cmake flag at
> configuration time.
>
>>
>> And ... what's the general state of the library? When I tried to use it, I
>> thought it's ready-to-use ...
>
> i pass a lots of time to review code in library since few weeks and i
> can said that implementation is better now (git/master). Crashes are
> now fixed, but it still memory leak with database (Qt4-sqlite plugin
> relevant).
>
>>
>> The face detection works fine, but does it work better than using OpenCV's
>> CascadeClassifier directly (cf. the small Python program I posted in
>> https://bugs.kde.org/show_bug.cgi?id=292900 )? Where's the difference? I think
>> this should be documented, as you surely put some effort into this, and
>> there's some good reason to use libkface.
>
> No idea, never tested. perhaps Marcel can respond better than me here.
> He has large experience about libkface as he has follow students who
> work on it in the past.
>
> In all case FaceDetection give excelent results with digiKam. Over
> 20000 face detected, only few are false (around 30-40)
>
>>
>> And what about the recognition feature? Just speaking for me, I wasn't able to
>> use it yet. What about the align and preprocess tools? What do I have to do to
>> be able to use it?
>
> No idea. Process work but i seen only few real recognition here.
>
>>
>> I thought of the library like "give it some faces to learn" and "give it the
>> face part of a photo, get a person suggestion". Is this "high-level" access
>> possible? It would be really fine if the library cared about alignment and
>> preprocessing so nothing can go wrong.
>
> Here Marcel can respond better than me.
>
>>
>> I would really like to use it or even contribute to this library. There's
>> surely a need for a good OSS face detection and recognition tool. I think
>> everything would be way easier if all that was documented somewhere. Like some
>> "This is what we have right now and this is what we can do with it". With some
>> minimalistic clear and working example code.
>
> Yes, please help is welcome. As API doc improvements, CLI test tool
> (for ex recognition part of KFaceGUI need to be ported on new libkface
> API)
>
> Don't hesitate to contribute, it will be welcome...
>
> Gilles Caulier
>
>>
>> At the moment, apart from the detection feature, It's quite hard to know
>> what's going on and how to use it ...
>>
>> Yours, Tobias
>> _______________________________________________
>> Digikam-devel mailing list
>> [hidden email]
>> https://mail.kde.org/mailman/listinfo/digikam-devel
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Marcel Wiesweg
In reply to this post by Tobias Leupold

> The face detection works fine, but does it work better than using OpenCV's
> CascadeClassifier directly (cf. the small Python program I posted in
> https://bugs.kde.org/show_bug.cgi?id=292900 )? Where's the difference? I
> think this should be documented, as you surely put some effort into this,
> and there's some good reason to use libkface.

We tested back and forth, in the end any of the available cascades was its
weaknesses, by using more than one cascade to verify candidates we got pretty
good results (there's even some literature that recommends this approach,
cited in the code IIRC)


>
> And what about the recognition feature? Just speaking for me, I wasn't able
> to use it yet. What about the align and preprocess tools? What do I have to
> do to be able to use it?

When LBPH by Philipp Wagner entered OpenCV, we had for the first time a
working recognition algorithm.
We have no working code for face alignment. I see one candidate with free
code, it's not in libkface and complex.

The API is designed to provide a high-level interface as you describe it. It
attempts to be backend-agnostic and is prepared for concurrent access (which
we do heavily in digikam).
Please not that the test tools are primarily meant to help with development
and not as examples for proper usage. There are API docs in the headers for
this purpose. And we are here to answer questions.

My example of proper API usage can be found in digikam's FacePipeline.cpp
(utils/facemanagement), in the classes RecognitionWorker and Trainer,
MapListTrainingDataProvider is an example of a non-trivial implementation of a
TrainingDataProvider.
I know, this is deeply tied into a multithreaded pipeline and digikam's
database. Just look at lines 943 - 1039 and 573 - 599.
Look at libs/database/facetags.cpp 233- 337 to see how we deal with libkface's
Identities, which we map to tags in digikam.

>
> I would really like to use it or even contribute to this library.

You are very welcome

Please note you are the first non-digikam user of this library that I know of.
If you need something we didn't think of, we can discuss everything.

Marcel
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Tobias Leupold
Am Donnerstag 26 Juni 2014, 15:16:48 schrieb Gilles Caulier:
> I restored Recognition feature in KFaceGUI test program. Take a look,
> in fact it simple to handle.

Thanks a lot, this really helps!

Am Donnerstag 26 Juni 2014, 19:23:20 schrieb Marcel Wiesweg:
> We tested back and forth, in the end any of the available cascades was its
> weaknesses, by using more than one cascade to verify candidates we got
> pretty good results (there's even some literature that recommends this
> approach, cited in the code IIRC)

The face detection really works fine. For my test images, it found most of the
faces. As already said, I think some small webpage about libkface would be
nice. There, one could e. g. mention that verifying multiple cascades is done
when detecting faces, as that's a real advantage compared with the "simple"
OpenCV approach.

> We have no working code for face alignment. I see one candidate with free
> code, it's not in libkface and complex.
Again, that would be something for a libkface home page. Perhaps, someone can
and wants to contribute regarding this?

> My example of proper API usage can be found in digikam's FacePipeline.cpp
> (utils/facemanagement), in the classes RecognitionWorker and Trainer,
> MapListTrainingDataProvider is an example of a non-trivial implementation of
> a TrainingDataProvider.

Well, then that's "all" I have to understand to write some nice recognition
code for KPA ;-)

> I know, this is deeply tied into a multithreaded pipeline and digikam's
> database. Just look at lines 943 - 1039 and 573 - 599.
> Look at libs/database/facetags.cpp 233- 337 to see how we deal with
> libkface's Identities, which we map to tags in digikam.

Thanks for the info. I'll have a look at this and try to understand what's
going on.

> Please note you are the first non-digikam user of this library that I know
> of. If you need something we didn't think of, we can discuss everything.

Thanks a lot for the friendly information. I hope I can get into all this soon
and write some nice code. I'm pretty sure you'll hear from me soon ;-)

Yours, Tobias
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Gilles Caulier-4
2014-06-27 15:06 GMT+02:00 Tobias Leupold <[hidden email]>:

> Am Donnerstag 26 Juni 2014, 15:16:48 schrieb Gilles Caulier:
>> I restored Recognition feature in KFaceGUI test program. Take a look,
>> in fact it simple to handle.
>
> Thanks a lot, this really helps!
>
> Am Donnerstag 26 Juni 2014, 19:23:20 schrieb Marcel Wiesweg:
>> We tested back and forth, in the end any of the available cascades was its
>> weaknesses, by using more than one cascade to verify candidates we got
>> pretty good results (there's even some literature that recommends this
>> approach, cited in the code IIRC)
>
> The face detection really works fine. For my test images, it found most of the
> faces. As already said, I think some small webpage about libkface would be
> nice. There, one could e. g. mention that verifying multiple cascades is done
> when detecting faces, as that's a real advantage compared with the "simple"
> OpenCV approach.
>
>> We have no working code for face alignment. I see one candidate with free
>> code, it's not in libkface and complex.
> Again, that would be something for a libkface home page. Perhaps, someone can
> and wants to contribute regarding this?

There is not really a web page about, excepted a link in digiKam.org :

http://www.digikam.org/sharedlibs

And KDE project page :

https://projects.kde.org/projects/extragear/libs/libkface/

Both are not really suitable for a more important documentation, i think.

But look here :

http://api.kde.org/extragear-api/libs-apidocs/libkface/libkface/html/index.html

It's the API doc population from source code. Why not to write a more
documented Doxygen main page for libkface. It's in git/master :

https://projects.kde.org/projects/extragear/libs/libkface/repository/revisions/master/entry/libkface/Mainpage.dox

What do you think about ?

Gilles Caulier
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Tobias Leupold
> It's the API doc population from source code. Why not to write a more
> documented Doxygen main page for libkface. It's in git/master :
>
> https://projects.kde.org/projects/extragear/libs/libkface/repository/revisio
> ns/master/entry/libkface/Mainpage.dox
>
> What do you think about ?

I think that would already be sufficient, if enough info was added to that API
reference. A "real" homepage would be probably too much, as an end-user won't
use this library directly anyways.

The more info one (a developer) can find about libkface simply using Google
and probably finding the API reference, the better it is I think.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Gilles Caulier-4
In reply to this post by Gilles Caulier-4
Tobias,

With this commit :

http://commits.kde.org/libkface/00eec4b3e473d6435663e0e3409281fe25457393

I restored training new faces to database into KFaceGUI test program...

Gilles Caulier

2014-06-26 15:16 GMT+02:00 Gilles Caulier <[hidden email]>:

> Tobias,
>
> With my commit http://commits.kde.org/libkface/dc0ac7b44c11a798543de7515ccc49190ea03086
>
> I restored Recognition feature in KFaceGUI test program. Take a look,
> in fact it simple to handle.
>
> It miss again training feature to update database.
>
> Gilles Caulier
>
> 2014-06-25 14:40 GMT+02:00 Gilles Caulier <[hidden email]>:
>> 2014-06-25 13:50 GMT+02:00 Tobias Leupold <[hidden email]>:
>>> Gilles,
>>>
>>> I have a few comments on
>>> https://projects.kde.org/projects/extragear/libs/libkface/repository/revisions/master/entry/DESIGN
>>>
>>>> Faces database file is hosted in home directory to be shared with all
>>>> applications which use libkface :
>>>
>>> I don't think that's always the case; at least the recognize program in test/
>>> does not use this path, but the current work dir to store the db.
>>
>> absolutely. An improvement can be to add a new CLI argument to adjust
>> database path.
>>
>>>
>>> And speaking generally of test/:
>>>
>>> The recognize tool works fine. As said, I was able to implement face detection
>>> using libkface with a few lines of code after having had a look at the
>>> sources.
>>>
>>> But I had to change all calls of kDebug() to qDebug(); kDebug() didn't produce
>>> any output here (im very new to programming C++/Qt/KDE, so perhaps, this is my
>>> fault; but it's quite confusing if the program doesn't speak). Same for the
>>> recognize program.
>>
>> run kdebugdialog and turn on KFace debug space to print trace on the
>> console. No need to use qDebug() instead
>>
>>>
>>>> KFaceGui is a simple application able to run detection and recognition
>>>> without to use CLI. Currently detection is implemented and recognition is
>>>> broken.
>>>
>>> The GUI in test/gui/ is (in contrast to the code in test/) not compiled when
>>> building libkface. I think it would be nice if at least a README would be
>>> placed here with how to do it. It would also ne nice if recognition was fixed
>>> here, so that on has an example of how to do it.
>>
>> It compile if you turn on -DKDE4_BUILD_TESTS=ON cmake flag at
>> configuration time.
>>
>>>
>>> And ... what's the general state of the library? When I tried to use it, I
>>> thought it's ready-to-use ...
>>
>> i pass a lots of time to review code in library since few weeks and i
>> can said that implementation is better now (git/master). Crashes are
>> now fixed, but it still memory leak with database (Qt4-sqlite plugin
>> relevant).
>>
>>>
>>> The face detection works fine, but does it work better than using OpenCV's
>>> CascadeClassifier directly (cf. the small Python program I posted in
>>> https://bugs.kde.org/show_bug.cgi?id=292900 )? Where's the difference? I think
>>> this should be documented, as you surely put some effort into this, and
>>> there's some good reason to use libkface.
>>
>> No idea, never tested. perhaps Marcel can respond better than me here.
>> He has large experience about libkface as he has follow students who
>> work on it in the past.
>>
>> In all case FaceDetection give excelent results with digiKam. Over
>> 20000 face detected, only few are false (around 30-40)
>>
>>>
>>> And what about the recognition feature? Just speaking for me, I wasn't able to
>>> use it yet. What about the align and preprocess tools? What do I have to do to
>>> be able to use it?
>>
>> No idea. Process work but i seen only few real recognition here.
>>
>>>
>>> I thought of the library like "give it some faces to learn" and "give it the
>>> face part of a photo, get a person suggestion". Is this "high-level" access
>>> possible? It would be really fine if the library cared about alignment and
>>> preprocessing so nothing can go wrong.
>>
>> Here Marcel can respond better than me.
>>
>>>
>>> I would really like to use it or even contribute to this library. There's
>>> surely a need for a good OSS face detection and recognition tool. I think
>>> everything would be way easier if all that was documented somewhere. Like some
>>> "This is what we have right now and this is what we can do with it". With some
>>> minimalistic clear and working example code.
>>
>> Yes, please help is welcome. As API doc improvements, CLI test tool
>> (for ex recognition part of KFaceGUI need to be ported on new libkface
>> API)
>>
>> Don't hesitate to contribute, it will be welcome...
>>
>> Gilles Caulier
>>
>>>
>>> At the moment, apart from the detection feature, It's quite hard to know
>>> what's going on and how to use it ...
>>>
>>> Yours, Tobias
>>> _______________________________________________
>>> Digikam-devel mailing list
>>> [hidden email]
>>> https://mail.kde.org/mailman/listinfo/digikam-devel
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Tobias Leupold
Am Samstag 28 Juni 2014, 08:58:52 schrieb Gilles Caulier:
> I restored training new faces to database into KFaceGUI test program...

Thanks a lot! I'll have a look at this. Yesterday, I was already able to
implement face recognition using a digikam-created recognition database and it
worked amazingly good on my test dataset :-)

So the "only" thing to do is to implement training and identity management ;-)
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Tobias Leupold
In reply to this post by Gilles Caulier-4
Gilles,

it seems to work fine :-) That should be all I need to be able to write my
recognition implementation! Great!

One thing for the example GUI: it uses the respective identity's "fullName"
which is not set by the training. So the found names are not displayed, only
"Is this ?". Perhaps, you want to change test/kfacegui/mainwindow.cpp (see the
attached patch) to make it work again.

Yous, Tobias
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

fix_names.patch (685 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Gilles Caulier-4
Patch applied to git/master

Gilles Caulier

2014-06-28 9:22 GMT+02:00 Tobias Leupold <[hidden email]>:

> Gilles,
>
> it seems to work fine :-) That should be all I need to be able to write my
> recognition implementation! Great!
>
> One thing for the example GUI: it uses the respective identity's "fullName"
> which is not set by the training. So the found names are not displayed, only
> "Is this ?". Perhaps, you want to change test/kfacegui/mainwindow.cpp (see the
> attached patch) to make it work again.
>
> Yous, Tobias
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
>
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Tobias Leupold
Hi Gilles, hi list!

I just wanted to let you know that, with your kind help, I was able to write a
face detection and face recognition implementation for kphotoalbum using
libkface (it's still a quite early state and there's still a lot of work to
do, but it works). I don't know if you digikam guys have ever had a look at
kphotoalbum ;-) but if you want, you can do so, the code can be found at

        https://github.com/l3u/kphotoalbum/tree/face_detection

The detection and recognition code resides in

        AnnotationDialog/ImagePreview.cpp

Thanks for the help again! I hope, I can help to develop and improve/enhance
libkface in the future somehow!

Yours, Tobias
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Gilles Caulier-4
2014-06-29 11:42 GMT+02:00 Tobias Leupold <[hidden email]>:
> Hi Gilles, hi list!
>
> I just wanted to let you know that, with your kind help, I was able to write a
> face detection and face recognition implementation for kphotoalbum using
> libkface (it's still a quite early state and there's still a lot of work to
> do, but it works). I don't know if you digikam guys have ever had a look at
> kphotoalbum ;-)

My time do not permit to do it currently. but if you find something
strange with libkface, let's me hear.

> but if you want, you can do so, the code can be found at
>
>         https://github.com/l3u/kphotoalbum/tree/face_detection
>
> The detection and recognition code resides in
>
>         AnnotationDialog/ImagePreview.cpp

Do you use multithreading here ?

Do you check kphotoalbum into valgrind to see if memory is leak with libkface ?

>
> Thanks for the help again! I hope, I can help to develop and improve/enhance
> libkface in the future somehow!

Has we said previouly, all help is welcome.

Please test your implementation. If you find some dysfunction don't
hesiate to report and propose patches.

All help about API doc can improve usability of libkface in other projects.

In KFaceGUI, there are some visual glitches with face rectangle, when
you move it for ex. I polished code a lots but not yet found the GUI
dysfunction. It's not very important but at least, if we can have a
clean implementation here, it will be cool.

The most important of course is to be sure that major dysfunction do
not appear with libkface database management (where i'm not sure if
all is properly done, if i follow all reports from digiKam).

https://bugs.kde.org/buglist.cgi?list_id=1086259&query_format=advanced&bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=ASSIGNED&bug_status=REOPENED&component=Face%20Management&product=digikam

Don't forget that you must use current implementation of libkface for
your tests, where code is the most hacked/tested for the moment.

Gilles Caulier
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface

Tobias Leupold
> > The detection and recognition code resides in
> >
> >         AnnotationDialog/ImagePreview.cpp
>
> Do you use multithreading here ?
No, it's just a procedural approach. At the moment, all scanning is done when
clicking a button on the image that is currently open and the widget is simply
disabled until it's done.

> Do you check kphotoalbum into valgrind to see if memory is leak with
> libkface ?
I'll try to do that, but -- to be honest -- I don't really know what the
valgrind output means ... I still have to learn about this.

> All help about API doc can improve usability of libkface in other projects.
Yeah, that's probably one thing I actually _can_ contribute to libkface.

> In KFaceGUI, there are some visual glitches with face rectangle, when
> you move it for ex. I polished code a lots but not yet found the GUI
> dysfunction. It's not very important but at least, if we can have a
> clean implementation here, it will be cool.
I just started coding C++/Qt/KDE back in April, so I think you're a bit
smarter than me, but I'll have a look at it and do my very best. If I find
something, I'll send a patch.

> Don't forget that you must use current implementation of libkface for
> your tests, where code is the most hacked/tested for the moment.
At the moment, I use the libkface version shipped with Digikam 4.0.0, but I'll
try to write an ebuild (I'm on Gentoo) installing the CVS version so that I
can check it against the latest code.

But as said: both detection and recognition work with this version. Surely,
both could be better, but, depending on the images used, the results are quite
impressive.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
12