ageitgey / ageitgey/face_recognition

Parameter known_face_locations for function face_encodings throwing an error

Open
#369 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
56.8k
Forks
13.7k
PR merge metrics
No merged PRs in 30d

Description

  • face_recognition version:
  • Python version:
  • Operating System:
Description

I'm trying to limit the area for processing with face_encodings but looks like it's with parameter known_face_locations

What I Did
image = face_recognition.load_image_file(file_name)
face_locations = face_recognition.face_locations(image)
face_encodings = face_recognition.face_encodings(
                file_name,
                known_face_locations=face_locations
            )

as a result i'm getting

  File "/usr/local/lib/python2.7/dist-packages/face_recognition/api.py", line 197, in face_encodings
    raw_landmarks = _raw_face_landmarks(face_image, known_face_locations, model="small")
  File "/usr/local/lib/python2.7/dist-packages/face_recognition/api.py", line 160, in _raw_face_landmarks
    return [pose_predictor(face_image, face_location) for face_location in face_locations]
RuntimeError: Expected writable numpy.ndarray with shape set.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in face_recognition/api.py at face_encodings and _raw_face_landmarks, using the reported example to reproduce the RuntimeError. Trace how known_face_locations is passed into the landmark predictor, then add or update a regression test showing that the parameter works without the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.