libkface: recognize without trained faces

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

libkface: recognize without trained faces

Tobias Leupold
Hi List/Gilles/Marcel!

We're working on libkface inclusion here at KPhotoAlbum at the moment (not
just me anymore :-). We found one thing that should probably handled by
libkface itself. It's more a cosmetic thing, but I think it wouldn't hurt to
change this.

If one issues a face recognition and no face has been trained yet, libkface
prints an error message to the console:

> OpenCV Error: Bad argument (This LBPH model is not computed yet. Did you
> call the train method?) in predict, file
> ...recognition-opencv-lbph/facerec_borrowed.cpp, line 384

This message disappears when the first face has been trained. I think it would
be nice if libkface would check for that itself and not print an error
message, but simply return nothing (as it already does at the moment).

What do you think?

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: recognize without trained faces

Gilles Caulier-4
Hi Tobias,

For me, I agree for this change but API doc must explain well the
returned value in all contexts.

Best

Gilles



2014-07-27 23:26 GMT+02:00 Tobias Leupold <[hidden email]>:

> Hi List/Gilles/Marcel!
>
> We're working on libkface inclusion here at KPhotoAlbum at the moment (not
> just me anymore :-). We found one thing that should probably handled by
> libkface itself. It's more a cosmetic thing, but I think it wouldn't hurt to
> change this.
>
> If one issues a face recognition and no face has been trained yet, libkface
> prints an error message to the console:
>
>> OpenCV Error: Bad argument (This LBPH model is not computed yet. Did you
>> call the train method?) in predict, file
>> ...recognition-opencv-lbph/facerec_borrowed.cpp, line 384
>
> This message disappears when the first face has been trained. I think it would
> be nice if libkface would check for that itself and not print an error
> message, but simply return nothing (as it already does at the moment).
>
> What do you think?
>
> 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: recognize without trained faces

Tobias Leupold
> For me, I agree for this change but API doc must explain well the
> returned value in all contexts.
Well, the return value would not change: at the moment, when a recognition is
issued without at least one face trained, it returns no identity and the
warning is displayed. When we would add some check and just return no
identity, everything is equal but we get rid of the warning.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: libkface: recognize without trained faces

Tobias Leupold
In reply to this post by Gilles Caulier-4
I just had a look at the sources. Actually, we already have the according
check, cf. recognition-opencv-lbph/facerec_borrowed.cpp:

        if(m_histograms.empty())
        {
                // throw error if no data (or simply return -1?)
                String error_message = "This LBPH model is not computed yet. Did you
call the train method?";
                CV_Error(CV_StsBadArg, error_message);
        }

Well ... I think it's up to you libkface maintainers if or if not this should
be displayed. In my opinion, this is not necessary, as it's perfectly clear
that no face can be recognized if no face has been trained yet.

In KPA, we simply avoided to get this message by counting the list of all
identities. When we have none, no recognition is issued. But I think it would
be the nicer solution if libkface simply would not display this message.

Remove it if you also think this way or leave it if not ;-)
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel