face_recognition | The world's simplest facial recognition api for Python and the command line | Computer Vision library

 by   ageitgey Python Version: v1.2.2 License: MIT

kandi X-RAY | face_recognition Summary

kandi X-RAY | face_recognition Summary

face_recognition is a Python library typically used in Artificial Intelligence, Computer Vision applications. face_recognition has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can install using 'pip install face_recognition' or download it from GitHub, PyPI.

The world's simplest facial recognition api for Python and the command line
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              face_recognition has a medium active ecosystem.
              It has 48536 star(s) with 12964 fork(s). There are 1575 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 698 open issues and 581 have been closed. On average issues are closed in 150 days. There are 28 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of face_recognition is v1.2.2

            kandi-Quality Quality

              face_recognition has 0 bugs and 0 code smells.

            kandi-Security Security

              face_recognition has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              face_recognition code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              face_recognition is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              face_recognition releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              face_recognition saves you 458 person hours of effort in developing the same functionality from scratch.
              It has 1081 lines of code, 61 functions and 24 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed face_recognition and discovered the below as its top functions. This is intended to give you an instant insight into face_recognition implemented functionality, and help decide if they suit your requirements.
            • Batch image locations
            • Trim CSS to bounding box
            • Wrapper for _raw_face_detector
            • Convert a rect to CSS
            • Return a list of landmarks for a given face image
            • Wrapper for face detection
            • Returns a list of face locations for a given face image
            • Convert css to a rectangle
            • Process a single frame
            • Return the next worker id
            • Return the previous worker id
            • Test if an image is likely to be similar
            • Print results
            • Render an image
            • Detect face encoding
            • Compute face encodings
            • Calculate face locations
            • Compute the eye aspect ratio
            • Compare two faces
            • Trains the model
            • Scan for known people
            • Captures a video
            • Process images in a multiprocessing process
            • Visualize prediction labels on an image
            • Predict the face of a given image
            • Run a test
            Get all kandi verified functions for this library.

            face_recognition Key Features

            No Key Features are available at this moment for face_recognition.

            face_recognition Examples and Code Snippets

            default
            Pythondot img1Lines of Code : 222dot img1no licencesLicense : No License
            copy iconCopy
            Ubuntu 17.04
            Python 2.7.14
            pycharm 开发工具
            
            $ sudo apt-get install build-essential cmake
            $ sudo apt-get install libgtk-3-dev
            $ sudo apt-get install libboost-all-dev
            
            $ pip install numpy
            $ pip install scipy
            $ pip install opencv-python
            $ pip install dlib
              
            Face Recognition-Usage-Command-Line Interface
            Pythondot img2Lines of Code : 59dot img2License : Permissive (MIT)
            copy iconCopy
            $ face_recognition ./pictures_of_people_i_know/ ./unknown_pictures/
            
            /unknown_pictures/unknown.jpg,Barack Obama
            /face_recognition_test/unknown_pictures/unknown.jpg,unknown_person
            
            $ face_detection  ./folder_with_pictures/
            
            examples/image1.jpg,65,215,  
            Face Recognition-Features
            Pythondot img3Lines of Code : 14dot img3License : Permissive (MIT)
            copy iconCopy
            import face_recognition
            image = face_recognition.load_image_file("your_file.jpg")
            face_locations = face_recognition.face_locations(image)
            
            import face_recognition
            image = face_recognition.load_image_file("your_file.jpg")
            face_landmarks_list = face_re  
            Break the while loop 10 seconds after executed
            Pythondot img4Lines of Code : 9dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            from datetime import datetime, timedelta
            ...
            
            loop_start_moment = datetime.now()
            while ...:
                # loop body
                if datetime.now() - loop_start_moment > timedelta(seconds=10):
                    break
            
            cannot append results to lists on multiprocessing
            Pythondot img5Lines of Code : 6dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            manager = Manager()
            knownEncodings = manager.list()
            knownNames = manager.list()
            no_faces = manager.list()
            error_in_image = manager.list()   
            
            cv2 does not have an attribute 'face'
            Pythondot img6Lines of Code : 2dot img6License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            recognizer = cv2.face.LBPHFaceRecognizer_create()
            
            "ERROR: CMake must be installed to build dlib" when installing face_recognition
            Pythondot img7Lines of Code : 2dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            ERROR: CMake must be installed to build dlib
            
            Can't convert object of type 'function' to 'str' for 'text
            Pythondot img8Lines of Code : 5dot img8License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            def get_temp(ser, num_samples=50):
                float_vals = [float(ser.readline()) for _ in range(num_samples)]
                avg_val = sum(float_vals)/len(float_vals) 
                return str(avg_val) # convert to string for open cv
            
            module 'cv2' has no attribute 'face'
            Pythondot img9Lines of Code : 4dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            pip uninstall opencv-contrib-python
            
            pip install opencv-contrib-python==4.4.0.46
            
            Resize livestream frame size from camera Pyqt5
            Pythondot img10Lines of Code : 53dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            class Ui_OutputDialog(QWidget):
                def __init__(self):
                    super(Ui_OutputDialog, self).__init__()
            
                    self.VBL = QVBoxLayout()
            
                    self.FeedLabel = QLabel()
                    self.VBL.addWidget(self.FeedLabel)
            
                    self.CancelBTN

            Community Discussions

            QUESTION

            cannot append results to lists on multiprocessing
            Asked 2022-Mar-18 at 11:30

            This below code will generate face encodings using multiprocessing , i can able to print the encoding but the problem is the knownEncodings ,knownNames ,no_faces ,error_in_image all are empty after the execution. I know its due to multiprocessing , but not sure how to mitigate this.

            ...

            ANSWER

            Answered 2022-Mar-18 at 10:46

            You should not use list cross several processes. You can use multiprocessing.Queue or other Process safe models. How to use multiprocessing queue in Python?

            Source https://stackoverflow.com/questions/71525117

            QUESTION

            "ERROR: CMake must be installed to build dlib" when installing face_recognition
            Asked 2022-Mar-01 at 22:50

            I'm facing this error while installing face_recognition in a virtualenv with Python 3.8.10 on Ubuntu 20.04.

            ...

            ANSWER

            Answered 2022-Mar-01 at 22:49
            ERROR: CMake must be installed to build dlib
            

            Source https://stackoverflow.com/questions/71315443

            QUESTION

            The called python file won't show again
            Asked 2022-Feb-20 at 13:56

            I am having problem calling the file online.py.

            Code:

            ...

            ANSWER

            Answered 2022-Feb-20 at 13:56

            Modules in Python are not supposed to be run multiple times, they are supposed to be a way of defining variables to be used in other scripts. Therefore importing a module twice does not run it twice; the interpreter stores the variables from the module the first time it is run, and if you try to import it again it will give you the variables it already has stored and not run the file again.

            There are a few ways of getting around this; here are two of them:

            1. Put the code in the module into a function, and import that function:

            Source https://stackoverflow.com/questions/71193516

            QUESTION

            PyInstaller: How to call "shape_predictor_68_face_landmarks.dat" file with dlib.shape_predictor, while imported it with 'binaries'?
            Asked 2021-Dec-29 at 09:04

            I have an small app, which is used face_recognition library. And I already imported it with

            ...

            ANSWER

            Answered 2021-Dec-29 at 09:04

            The solution was as simple as possible:

            We can use face_recognition.face_landmarks function instead to get landmarks.

            Source https://stackoverflow.com/questions/70511338

            QUESTION

            Sorting a tensor list in ascending order
            Asked 2021-Dec-05 at 21:29

            I am working on a facial comparison app that will give me the closest n number of faces to my target face.

            I have done this with dlib/face_recognition as it uses numpy arrays, however i am now trying to do the same thing with facenet/pytorch and running into an issue because it uses tensors.

            I have created a database of embeddings and I am giving the function one picture to compare to them. What i would like is for it to sort the list from lowest distances to highest, and give me the lowest 5 results or so.

            here is the code I am working on that is doing the comparison. at this point i am feeding it a photo and asking it to compare against the embedding database.

            ...

            ANSWER

            Answered 2021-Dec-05 at 16:43

            Unfortunately I cannot test your code, but to me it seems like you are operation on a python list of tuples. You can sort that by using a key:

            Source https://stackoverflow.com/questions/70232894

            QUESTION

            problem in Installing (python Library) face_recognition on windows 10/11
            Asked 2021-Nov-26 at 05:09

            I am using python 3.9.9 pip 21.3.1

            I am trying to install face_recognition

            so I installed CMake then when I tried to install dlib using command pip install dlib I got the following

            ...

            ANSWER

            Answered 2021-Nov-20 at 08:45

            Fortunately, I solved the problem. These are the steps to download face_recognition Library:

            1- install python:

            in the command prompt write python and click Enter, this will open Microsoft store for you, "click download" or "install" to download and install python. "to check if it is downloaded or not type python in the command prompt

            2- install pip if you do not have it:

            go to: https://pypi.org/project/pip-download/ click download files. Now open the downloaded file, then click right click with the mouse and choose "open in windows terminal". now type the command python get-pip.py. now your pip should be installed, type pip in the terminal to check if it is installed

            3-Install Visual Studio tools For C++

            go to: https://visualstudio.microsoft.com/ and download the community version of VS. after downloading install it and choose the following options in the installation page:
            image1 image2

            and choose install

            4- installing cmake

            Enter the command pip install cmake and wait fo it to be installed.

            5- Add cmake to the Path variable

            follow the instructions in the following link to know how to add something to your Path variable: https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/

            6- Install dlib

            write the following command in the command prompt: pip install dlib

            7- install face_recognition

            write the following command in the command prompt: pip install face_recognition

            8- start your project in PyCharm

            click File click Sittings in the search type "interpreter" choose "python interpreter" choose "show all" click the "+" sign choose system Interpreter choose the interpreter that its path starts with the "users" directory

            That is the solution I used to fix my problem

            Source https://stackoverflow.com/questions/70001837

            QUESTION

            Celery/redis tasks don't always complete - not sure why or how to fit it
            Asked 2021-Nov-25 at 05:54

            I am running celery v 4.0.3/redis v 4.09 in a django v 3.0.1 application (Python v 3.6.9). I am also using face_recognition in a celery task find_faces to find faces in the images I have uploaded to the application, among other image processing celery tasks. There are no issues processing five or fewer image files in that all the image processing celery tasks complete successfully.

            When I have the image process tasks (including find_faces) iterate over 100 images there are 10-30 images where the find_faces task does not complete. When I use flower v0.9.7 to take a look at the celery tasks, I see that the find_faces task status is "started" for those images that did not complete. All the other images have find_faces task status as "success". The status of these "started" tasks never changes, and there are no errors or exceptions reported. I can then run the image processing tasks, including the find_faces task, on each of these images individually, and the task status is "success". These results do not change if I run celery as a daemon or locally, or if I run the django app using wsgi and apache or runserver. Flower also reports that retries = 0 for all my tasks.

            I have CELERYD_TASK_SOFT_TIME_LIMIT = 60 set globally in the django app, and max_retries=5 for the find_faces task.

            ...

            ANSWER

            Answered 2021-Nov-25 at 05:54

            After some more research, I can up with this suggestion from Lewis Carroll, in this post "Beware the oom-killer, my son! The jaws that bite, the claws that catch!", and this post Chaining Chords produces enormously big messages causing OOM on workers, and this post WorkerLostError: Worker exited prematurely: exitcode 155.

            It seems my celery workers may have been running out of memory, as I did find traces of the dreaded oomkiller in my syslogs. I reconfigured my tasks to just be in a chain (removed all the groups and chords) so each task is run individually in sequence for each image, and the tasks all completed successfully, no matter how many images I processed.

            Source https://stackoverflow.com/questions/70074740

            QUESTION

            is possible to face recognition with mediapipe in python
            Asked 2021-Nov-12 at 02:45

            I try to make app with python to be able recognition face, recently use cv2+dlib and face_recognition module for recognition, but i have two problems:

            1. have 3 or 4 second delay
            2. low accuracy

            That's why I decided to use another library, after so many search, find MediaPipe, this library is very fast (real time) and find this example for face detection, but I need face recognition! but not found any example for face recognition Is there a solution?

            ...

            ANSWER

            Answered 2021-Sep-24 at 12:26

            Mediapipe doesn't provide a face recognition method, only face detector.

            The face_recognition library has really good accuracy, It's claimed accuracy is 99%+. your dataset probably isn't good enough.

            Solutions:

            1. For better speed performance, use the "hog" model instead of "cnn" model. you can modify it when you use the face_locations method like the following code line.

            Source https://stackoverflow.com/questions/69264221

            QUESTION

            "No CMAKE_CXX_COMPILER could be found" errror while deploying flask app on gcloud
            Asked 2021-Nov-07 at 14:13

            I have a flask application that I'm deploying on google cloud run. The app using a library 'face_recognition' that requires Cmake. I'm installing the CMake by running a command in DockerFile but getting an error. I don't know what it mean.

            Here is my Dockerfile

            ...

            ANSWER

            Answered 2021-Nov-06 at 18:15

            The container base python:3.9-slim is very stripped down. If your application requires CMake which often implies the gcc compiler as well, you have at least two options:

            1. Use a more feature rich base container such as debian:buster
            2. Choose a container with those tools already configured.

            Example Dockerfile to build a base container:

            Source https://stackoverflow.com/questions/69865503

            QUESTION

            I am trying to load and split my data however i get TypeError: 'only integer scalar arrays can be converted to a scalar index'
            Asked 2021-Nov-06 at 09:35
            Imports ...

            ANSWER

            Answered 2021-Nov-06 at 09:12

            Seems like you are using an outdated version of the dataset. You see the updated link here. The code you have will not work because you are asking for splits on data and target, while you are only providing target.

            Something like this should work (on sklearn 0.24.1) :

            Source https://stackoverflow.com/questions/69862572

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install face_recognition

            First, make sure you have dlib already installed with Python bindings:.
            How to install dlib from source on macOS or Ubuntu
            Jetson Nano installation instructions Please follow the instructions in the article carefully. There is current a bug in the CUDA libraries on the Jetson Nano that will cause this library to fail silently if you don't follow the instructions in the article to comment out a line in dlib and recompile it.
            Raspberry Pi 2+ installation instructions
            @masoudr's Windows 10 installation guide (dlib + face_recognition)
            Download the pre-configured VM image (for VMware Player or VirtualBox).

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/ageitgey/face_recognition.git

          • CLI

            gh repo clone ageitgey/face_recognition

          • sshUrl

            git@github.com:ageitgey/face_recognition.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link