Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

usage.rst 1.6 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  1. =====
  2. Usage
  3. =====
  4. To use Face Recognition in a project::
  5. import face_recognition
  6. See the examples in the /examples folder on github for how to use each function.
  7. You can also check the API docs for the 'face_recognition' module to see the possible parameters for each function.
  8. The basic idea is that first you load an image::
  9. import face_recognition
  10. image = face_recognition.load_image_file("your_file.jpg")
  11. That loads the image into a numpy array. If you already have an image in a numpy array, you can skip this step.
  12. Then you can perform operations on the image, like finding faces, identifying facial features or finding face encodings::
  13. # Find all the faces in the image
  14. face_locations = face_recognition.face_locations(image)
  15. # Or maybe find the facial features in the image
  16. face_landmarks_list = face_recognition.face_landmarks(image)
  17. # Or you could get face encodings for each face in the image:
  18. list_of_face_encodings = face_recognition.face_encodings(image)
  19. Face encodings can be compared against each other to see if the faces are a match. Note: Finding the encoding for a face
  20. is a bit slow, so you might want to save the results for each image in a database or cache if you need to refer back to
  21. it later.
  22. But once you have the encodings for faces, you can compare them like this::
  23. # results is an array of True/False telling if the unknown face matched anyone in the known_faces array
  24. results = face_recognition.compare_faces(known_face_encodings, a_single_unknown_face_encoding)
  25. It's that simple! Check out the examples for more details.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...