-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom handling of FaceRecognizer results #402
Conversation
To implement this method u just have to do same internal cycle as in predict(InputArray src, CV_OUT int &label, CV_OUT double &confidence) but | ||
not try to get "best@ result, just resend it to caller side with given collector | ||
*/ | ||
CV_WRAP virtual void predict_collect(InputArray src, PredictCollector collector) const = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the automated scripting generator (for python java,etc) can't handle callbacks (save c++11 things), this might have to go without the CV_WRAP tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK will fix it
suggestions fixed |
(disclaimer: i haven't tried) the linux/android builds might need enabling c++11, similar to this |
3a23a9d
to
0616037
Compare
@comdiv, why didn't you use object as a handler? Something similar to: struct Collector {
virtual bool collectOne(int, double, int) = 0;
}
...
virtual void predict_collect(InputArray src, Collector & collector, const int state = 0) const = 0; I think it is not a good idea to have different interfaces for different C++ standards. If one have library compiled with C++03 compiler than all applications using this library will be restricted to use same standard, otherwise linking errors will occur. |
I think that really better is to use Iterator patter -
As it used to be in .NET world - so client side decide itself how to deal with that. While may be Collector class should be more usefull while we can predefine MaxCollector, AvgCollector, FirstByTreshholdCollector, Top10Collector and so on with ready to use aggregations. Such set of classes could be Templated and be capable work with different collect_one notations. The only thing is not good - while i'm using (bool*) and std::funciton it's just overload of predict, expressed in other C++ standard things. When we add Collector class family we grow entropy of opencv + opencv_contrib design. Where it could be defined? In face? In shared code for contrib? In opencv? Somwhere else? |
Think I'll rewrite on collector as class design and replace existed master overload of predict (while it's more generic). |
Have totally rewrite facerecognizer internals to use with PredicCollector class, |
2016a0b
to
30bb818
Compare
require suggestion - how to make it Pythonable? |
1bbca8a
to
093fc58
Compare
Try to change to CV_WRAP virtual void predict(InputArray src, Ptr<PredictCollector> collector, const int state = 0) const = 0; Also, users will need to create instances of PredictCollector in python, for this factory method should be implemented (static class method or separate function): Ptr<MinDistancePredictCollector> MinDistancePredictCollector::create() {} |
5e10eff
to
7b129a6
Compare
All green but builds was renamed so warning in github still occures |
@comdiv, please replace tabs with 4 spaces. |
done |
Is it usefull to add some custom PredictCollector implementations? |
@comdiv , please revert all unrelated changes e.g. code formatting. |
Have fixed |
* without specific prior written permission. | ||
* | ||
* See <http://www.opensource.org/licenses/bsd-license> | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this license is wrong. Please replace it with text from the main license.
I have no other comments. |
yes, copyed license from somewhere in opencv or opencv-contrib, will place your one |
predict method rewritten to use with PredictCollector interface (abstract class) now face recognizer allow to perform different scenarios of result handling
Have applyed valid license. |
@comdiv , yes it could be useful. I think it is better to create new PR for this. Maybe we could also implement a simple example of using new interface. 👍 |
What is better?
|
Just create a new PR with the proposed functionality, new issue is not necessary. |
Have question - can std::list be used with CV_WRAP , if not what is common type and conversion for such return values. |
* Updated history_cuda.yml, sanitizer_cuda.yml and test_cuda.yml pipelines: 1) All cuda_plugin pipelines will be run if cuda_plugin fiolder was changed 2) Updated sanitizer_cuda.yml with proper CudaFuncTests's filters due to memory exhausting under cuda-memcheck * Renamed Range test to be handled by sanitizer_cuda * Update timeout for CUDAPlugin_Lin to 60 minutes Made separate Azure pipeline for CUDA
It's code that can close #401 or can be used as suggestion to close this ticket