ageitgey / ageitgey/face_recognition

Having ValueError for some Images

Open
#595 3 comments 0 reactions 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: 1.2.2
  • Python version: 3.6.5
  • Operating System: Ubuntu 18.04 x86_64
Description

I get this error when i preprocess the data and reuse it
but when using cli it works fine

Traceback (most recent call last):
  File "detect_img.py", line 21, in <module>
    result = face_recognition.compare_faces(face_encodings, unknown_face)
  File "/home/apurva/FREC/frec/lib/python3.6/site-packages/face_recognition/api.py", line 212, in compare_faces
    return list(face_distance(known_face_encodings, face_encoding_to_check) <= tolerance)
  File "/home/apurva/FREC/frec/lib/python3.6/site-packages/face_recognition/api.py", line 72, in face_distance
    return np.linalg.norm(face_encodings - face_to_compare, axis=1)
ValueError: operands could not be broadcast together with shapes (4,128) (2,128)

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 with the traceback locations in face_recognition/api.py, especially face_distance at line 72 and compare_faces at line 212. Reproduce both the preprocessing/reuse path and the CLI path, comparing the reported (4,128) and (2,128) shapes. Done means the reported reuse case has a clear, verified outcome without the broadcasting error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.