Face_recognition: "Unsupported image type, must be 8bit gray or RGB image." using face_recognition.batch_face_locations

Created on 23 Jan 2018  路  1Comment  路  Source: ageitgey/face_recognition

  • face_recognition version: 0.1.0
  • Python version: 3.6
  • Operating System: Ubuntu

On my AWS GPU instance (p2.xlarge), dlib with cuda enabled, batch_face_locations gave me this error

RuntimeError: Unsupported image type, must be 8bit gray or RGB image.

, but face_locations(img, model='cnn') works fine.

The following code works fine on my Mac, but not on the server:

import face_recognition
img = face_recognition.load_image_file('1.jpeg')
face_recognition.batch_face_locations([img])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/miniconda3/lib/python3.6/site-packages/face_recognition/api.py", line 141, in batch_face_locations
    raw_detections_batched = _raw_face_locations_batched(images, number_of_times_to_upsample)
  File "/home/ubuntu/miniconda3/lib/python3.6/site-packages/face_recognition/api.py", line 124, in _raw_face_locations_batched
    return cnn_face_detector(images, number_of_times_to_upsample)
RuntimeError: Unsupported image type, must be 8bit gray or RGB image.
face_recognition.__version__
> '0.1.0'
img.shape
> (366, 650, 3)

Most helpful comment

i guess there is problem in face_recognition/api.py file.
u can correct it manually :
find _raw_face_locations_batched function and add "batch_size=128" in arguments list
then add "batch_size=batch_size" argument in return cnn_face_detector func.

>All comments

i guess there is problem in face_recognition/api.py file.
u can correct it manually :
find _raw_face_locations_batched function and add "batch_size=128" in arguments list
then add "batch_size=batch_size" argument in return cnn_face_detector func.

Was this page helpful?
0 / 5 - 0 ratings