ageitgey / ageitgey/face_recognition

Runtime err : Expected numpy.ndarray of uint8

Open
#386 2 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.1
  • Python version: 2.7
  • Operating System: macOS 10.12.1
Description

The code throws a Runtime error when face_detector is called, printing:
Expected numpy.ndarray of uint8

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

Traceback

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/face_recognition/api.py", line 116, in face_locations
    return [_trim_css_to_bounds(_rect_to_css(face), img.shape) for face in _raw_face_locations(img, number_of_times_to_upsample, model)]
  File "/Library/Python/2.7/site-packages/face_recognition/api.py", line 100, in _raw_face_locations
    return face_detector(img, number_of_times_to_upsample)
RuntimeError: Expected numpy.ndarray of uint8

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

Reproduce the reported snippet with Python 2.7 and inspect face_recognition/api.py at _raw_face_locations (line 100) and face_locations (line 116). Determine why the loaded image is rejected as not a uint8 numpy.ndarray; done means the example runs without the reported RuntimeError.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.