Giter Club home page Giter Club logo

Comments (11)

ageitgey avatar ageitgey commented on May 2, 2024 1

@Cospel I submitted a dlib python wrapper for the mmod cnn face detector. So I should be able to make that an option in face_recognition when the next dlib update is released.

from face_recognition.

ageitgey avatar ageitgey commented on May 2, 2024
  1. Great question. I looked into it. The problem is that dlib's CNN interface isn't available from python and I don't think @davisking has any plans to support that interface from Python (because of how it's written). So I don't think it's (easily) possible.

  2. I think it will use a gpu if you compile dlib with CUDA support, but I can't remember for sure. I'll try recompiling it on my linux machine when I have a minute and check.

from face_recognition.

ageitgey avatar ageitgey commented on May 2, 2024

Yeah, it seems to use the GPU when you compile dlib with CUDA support. Here's what the card reports when running face_recognition.face_encodings() in a loop (passing in face locations so it doesn't have to re-look that up each time):

$ nvidia-smi 
Fri Mar 17 16:51:41 2017       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 367.57                 Driver Version: 367.57                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 980 Ti  Off  | 0000:01:00.0      On |                  N/A |
|  0%   47C    P2    78W / 250W |    842MiB /  6074MiB |     39%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0      1251    G   /usr/lib/xorg/Xorg                             197MiB |
|    0      6181    C   python3                                        283MiB |

With GPU support, it took me a little under a minute to calculate 10,000 face encodings. For comparison, my laptop (different hardware) without a GPU took over 4 min to do the same thing.

from face_recognition.

davisking avatar davisking commented on May 2, 2024

It's certainly possible to make a python API for the CNN face detector model. Although as @ageitgey mentioned, it's impossible to make a full wrapper for the entire DNN API in python because python lacks the core language mechanics to deal with the C++ API. But that's not what you are asking about.

As for GPU use. If you compile dlib to use CUDA it will use CUDA, if you don't then it won't. This has nothing to do with using python or anything else.

from face_recognition.

davisking avatar davisking commented on May 2, 2024

Also, I'm in general not very motivated to add dlib python wrappers since I hardly ever use pyhton myself. So someone else should do it and submit a PR :)

from face_recognition.

ageitgey avatar ageitgey commented on May 2, 2024

Fair enough @davisking. Thanks for the reply!

from face_recognition.

Cospel avatar Cospel commented on May 2, 2024

Thank you for your answers!

What I have now is face detection based on facenet/openface https://github.com/davidsandberg/facenet. And face recognition or better say face descriptor from dlib/resnet/face_recognition.

My expertise in C++ is very bad and it is few years that I last touch it. However I tried to play with C++ Boost to port MMOD CNN to the python but with no success.

from face_recognition.

xinshengdehuamei avatar xinshengdehuamei commented on May 2, 2024

@ageitgey How can i compile the dlib with CUDA support ? Usually I use 'python setup.py install' to install the dlib in Ubantu. How can I make sure the dlib with CUDA support is successful ?

from face_recognition.

davisking avatar davisking commented on May 2, 2024

from face_recognition.

xinshengdehuamei avatar xinshengdehuamei commented on May 2, 2024

@davisking Yes, thank you !

from face_recognition.

yanglixiao1994 avatar yanglixiao1994 commented on May 2, 2024

@davisking Hi. I already compiled dlib with cuda enable.
image
In c++ code,dlib::cuda::get_num_devices()==1,but dlib::cuda::get_device_name=="CUDA_DISABLED".And MMOD face detector use the cpu version instead of cuda.Do you have any idea?

from face_recognition.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.