kandi background

face_recognition | simplest facial recognition api for Python and the command line | Computer Vision library

Download this library from

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

kandi-support Support

  • face_recognition has a medium active ecosystem.
  • It has 41296 star(s) with 11514 fork(s). There are 1604 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 617 open issues and 548 have been closed. On average issues are closed in 72 days. There are 24 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

quality kandi Quality

  • face_recognition has 0 bugs and 0 code smells.

securitySecurity

  • 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.

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.

buildReuse

  • 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.

  • Train training data .
  • Processes a single frame .
  • Detect face encoding .
  • Show predictions on the frame
  • Predict the predictions from an example frame .
  • Returns the landmark for the specified face image .
  • Display an image .
  • Test an image .
  • Processes the images in the process .
  • capture a single frame

face_recognition Key Features

Find all the faces that appear in a picture:. Get the locations and outlines of each person's eyes, nose, mouth and chin.

face_recognition Examples and Code Snippets

  • Features
  • Installation Options:
  • Command-Line Interface
  • cannot append results to lists on multiprocessing
  • "ERROR: CMake must be installed to build dlib" when installing face_recognition
  • The called python file won't show again
  • Sorting a tensor list in ascending order
  • is possible to face recognition with mediapipe in python
  • "No CMAKE_CXX_COMPILER could be found" errror while deploying flask app on gcloud
  • I am trying to load and split my data however i get TypeError: 'only integer scalar arrays can be converted to a scalar index'
  • How to list lowest values in numpy array
  • list/numpy array out of range
  • Module not imported running python script at startup

Features

import face_recognition
image = face_recognition.load_image_file("your_file.jpg")
face_locations = face_recognition.face_locations(image)

Community Discussions

Trending Discussions on face_recognition
  • cannot append results to lists on multiprocessing
  • "ERROR: CMake must be installed to build dlib" when installing face_recognition
  • The called python file won't show again
  • PyInstaller: How to call "shape_predictor_68_face_landmarks.dat" file with dlib.shape_predictor, while imported it with 'binaries'?
  • Sorting a tensor list in ascending order
  • problem in Installing (python Library) face_recognition on windows 10/11
  • Celery/redis tasks don't always complete - not sure why or how to fit it
  • is possible to face recognition with mediapipe in python
  • "No CMAKE_CXX_COMPILER could be found" errror while deploying flask app on gcloud
  • I am trying to load and split my data however i get TypeError: 'only integer scalar arrays can be converted to a scalar index'
Trending Discussions on face_recognition

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.

import face_recognition
from imutils import paths
from multiprocessing import Pool
import pickle
import cv2
import os,sys,time

print("[INFO] quantifying faces...")

img_folder_path=sys.argv[1]

image_paths = list(paths.list_images(img_folder_path))

knownEncodings = []
knownNames = []
no_faces = []
error_in_image =[]

def create_encoding(imagePath):
    print("[INFO] processing image...")
    name = imagePath.split(os.path.sep)[-1]
    image = cv2.imread(imagePath)
    if image is None:
        return
    rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

    # detect the (x, y)-coordinates of the bounding boxes
    # corresponding to each face in the input image
    boxes = face_recognition.face_locations(rgb)

    # compute the facial embedding for the face
    if len(boxes) != 0:
        boxes = list(boxes[0])
        encodings = face_recognition.face_encodings(image, [boxes])
        for encoding in encodings:  
            knownEncodings.append(encoding)
            knownNames.append(name)
        
    else:
        print("no face found" ,image_paths )
        no_faces.append(image_paths )



# loop over the image paths with multiprocessing
start_time = time.time()

with Pool(8) as pool:
    pool.map(create_encoding, image_paths )


end_time = time.time()
print(end_time - start_time)

# dump the facial encodings + names to disk
print("[INFO] serializing encodings...")
data = {"encodings": knownEncodings, "names": knownNames, "no_faces":no_faces,"error_in_image":error_in_image}

f_name = img_folder_path.replace("/","-")
print(f_name)
f = open(f"encodings_{f_name}.pickle", "wb")
f.write(pickle.dumps(data))
f.close()

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

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 .

Build your Application

Share this kandi XRay Report