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

Installed MKL - no improvement in face detection #1528

Closed
sergei-sh opened this issue Oct 25, 2018 · 18 comments
Closed

Installed MKL - no improvement in face detection #1528

sergei-sh opened this issue Oct 25, 2018 · 18 comments
Labels

Comments

@sergei-sh
Copy link

sergei-sh commented Oct 25, 2018

I've installed MKL, recompiled DLIB and see almost no time difference in face detection.
Ensured importing the correct module.
MKL was found during compilation, no errors there.
I use get_frontal_face_detector from Python and run 64 consecutive detections on the same images.

Using the latest dlib under CentOs 7.5. I also compile with CUDA at the same time.

@davisking
Copy link
Owner

davisking commented Oct 25, 2018 via email

@sergei-sh
Copy link
Author

Hi, thanks for the answer. But I'm still confused. You use BLAS in matrix.h and matrix is used in scan_fhog_pyramid. To me this means the HOG detector should benefit from MKL. Am I wrong?

@davisking
Copy link
Owner

Yes, you are wrong.

@sergei-sh
Copy link
Author

But I clearly see my Dlib is linked against MKL libraries which contain BLAS functions which are being used by matrix class.

Could you help with any hint to understand which parts of Dlib do utilize this functionality?

@davisking
Copy link
Owner

Just look at the fhog extraction code. You can see what it does. That goes for anything else, look and see what it does.

@xsacha
Copy link
Contributor

xsacha commented Nov 19, 2018

Is there much benefit for MKL if you are using CUDNN?

@davisking
Copy link
Owner

The hog based detectors don’t use mkl or cudnn. So it doesn’t matter either way.

@xsacha
Copy link
Contributor

xsacha commented Nov 19, 2018

What about if we use DNN face detector? With CUDNN, would MKL have any benefit?

@davisking
Copy link
Owner

If you are using the DNN tooling the network is running either all on the GPU or all on the CPU. So installing a CPU acceleration library like the MKL will do nothing if you are already using cudnn.

@xsacha
Copy link
Contributor

xsacha commented Nov 19, 2018

The feature detector (shape) for face cannot be run on the GPU at this stage right? So, even with everything on GPU, this part (which is quite expensive) is on the CPU. Would it make use of MKL?

@davisking
Copy link
Owner

The shape_predictor should be super fast. But yes, it's just on the CPU. I don't think it benefits from the MKL either.

@xsacha
Copy link
Contributor

xsacha commented Nov 19, 2018

It uses more than everything else on CPU (which is close to 0%) ;) So it ends up in profiling.

So if we are using CUDNN, then ideally we don't need BLAS?

@davisking
Copy link
Owner

I don't think we are talking about the same thing. The shape_predictor runs in about a millisecond on a normal computer.

@xsacha
Copy link
Contributor

xsacha commented Nov 19, 2018

It does add up on my machine. Consider the scenario where you have 10 HD cameras and up to a dozen faces per camera. It seems to matter more about the size of the face too so I attempt to shrink them first.
The CUDNN keeps up fine but the CPU begins to be used up.

@davisking
Copy link
Owner

davisking commented Nov 19, 2018 via email

@xsacha
Copy link
Contributor

xsacha commented Nov 19, 2018

It's over multiple cores already but with database and everything else, it adds up.
Was just wondering if it uses MKL. If not, I guess I can remove it.

@dlib-issue-bot
Copy link
Collaborator

Warning: this issue has been inactive for 30 days and will be automatically closed on 2018-12-24 if there is no further activity.

If you are waiting for a response but haven't received one it's likely your question is somehow inappropriate. E.g. you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's documentation, or a Google search.

@dlib-issue-bot
Copy link
Collaborator

Notice: this issue has been closed because it has been inactive for 35 days. You may reopen this issue if it has been closed in error.

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

No branches or pull requests

4 participants