Skip to content
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

Dlib object detection and tracking #22

Closed
vinicius121 opened this issue Jun 25, 2018 · 11 comments
Closed

Dlib object detection and tracking #22

vinicius121 opened this issue Jun 25, 2018 · 11 comments

Comments

@vinicius121
Copy link

Hi,

I trained a object detector in python using Dlib. It detects and tracks the object successfully.
Now I would like to do the same in C#. I know that I can call the correlation tracker in C#. However, it seems that I can't call the dlib.simple_object_detector() function which accepts the trained model. Is there any alternative to this?
Also is there any implementation of the dlib fast multiclass object detection method?http://blog.dlib.net/2017/09/fast-multiclass-object-detection-in.html
More information here: http://dlib.net/train_object_detector.py.html

Thanks,

Vinícius

@takuya-takeuchi
Copy link
Owner

simple_object_detetor is missing in C++ api.
It is typedef and defined in the below.
https://github.com/davisking/dlib/blob/master/tools/python/src/simple_object_detector.h

However, maybe there is not some C# api corresponds to above.

@vinicius121
Copy link
Author

Hi,

Thanks for answering. Is there a way to import this to the DlibDotNet?

Thanks,

Vinícius

@takuya-takeuchi
Copy link
Owner

You have to implement these C++ APIs in DlibDotNet.Native project and wrap them in DlibDotNet.
In any case, it may not be easy.

In the near future, I might as well implement. However, I am writing the dnn face recognition wrapper. So I have no time and I can not work on now. I'm verry sorry.

@postacik
Copy link

Great to hear that you are working on the face recognition wrapper. I think it will be used by many projects.

@takuya-takeuchi
Copy link
Owner

Hi, I'm sorry for delay report.
I ported examples\fhog_object_detector_ex.cpp to C#.
https://github.com/takuya-takeuchi/DlibDotNet/tree/develop/examples/FHogObjectDetector

This sample is similar with simple_object_detector.h.

Have a try!

@vinicius121
Copy link
Author

vinicius121 commented Jul 10, 2018

Hi,

No worries. Thanks for implementing it.
I already have a detector trained in python to detect an object.
Now, I'm trying to run the detector to detect the object in real time using a webcam.
From what I understood when analyzing the code you use this detector.Deserialize("detector.svm"); to recall the detector, right?
Then you use detector.Operator(); to detect the object in an image?
Finally, I'm using OpenCVSharp 3 to capture the frames by using VideoCapture. Then, I convert it to Mat. My problem now is how do I convert Mat to Matrix<byte>?

Thanks,

Vinícius Silva

@takuya-takeuchi
Copy link
Owner

detector.Deserialize("detector.svm"); to recall the detector, right?

it’s not meaningful. in original sample code, this statement only demonstrate how to reuse trained model.

detector.Operator(); to detect the object in an image?

Correct.
Operator returns bounding boxes.

My problem now is how do I convert Mat to Matrix?

I often use OpenCvSharp3.
First, You copy Mat.data to managed array.
Then you can use LoadImageData and Matrix constructor.

I guess some developer use dlib and opencv.
Therefore, I will create sample to demonstrate how to convert data dlib to opencv, vice versa.

@takuya-takeuchi
Copy link
Owner

Hi vinicius121
I ported examples\webcam_face_pose_ex.cpp to C#.
https://github.com/takuya-takeuchi/DlibDotNet/tree/develop/examples/WebcamFacePose

The above sample use OpenCVSharp3 to use WebCam and covert Mat to Array2D.

Have a try!

@omdxp
Copy link

omdxp commented May 28, 2019

Hi takuya-takeuchi
I saw your WebcamFacePose example but I got an error
When I use Marshal.Copy method it gives me this error : "Argumen 1 : cannot convert from 'System.array' to 'int[]'"

@takuya-takeuchi
Copy link
Owner

When I use Marshal.Copy method it gives me this error : "Argumen 1 : cannot convert from 'System.array' to 'int[]'"

Go to #112

@omdxp
Copy link

omdxp commented May 28, 2019

Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants