Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during face recognition: Unsupported image type, must be 8bit gray or RGB image. #1574

Open
BadOOOFra opened this issue Jun 27, 2024 · 3 comments

Comments

@BadOOOFra
Copy link

  • face_recognition version: 1.3.0
  • Python version: 3.12.4
  • Operating System: MacOS Sonoma Version 14.5 (23F79)

Description

I am trying to implement a face recognition login system using the face_recognition library in a Flask web application. The image is captured from a webcam using JavaScript, converted to a data URL, and sent to the server. However, I am consistently encountering the error Unsupported image type, must be 8bit gray or RGB image despite ensuring the image is in the correct format.

What went wrong:

•	The error occurs during the face_recognition.face_encodings function call.
•	Debugging indicates that the image is converted to RGB and is an 8-bit image, but the error persists.

Expected:

•	The function face_recognition.face_encodings should process the image and return face encodings if faces are detected.

What I Did

Traceback:

DEBUG: STREAM b'IHDR' 16 13
DEBUG: STREAM b'sRGB' 41 1
DEBUG: STREAM b'IDAT' 54 8192
DEBUG: Original image mode: RGBA
DEBUG: Converted image mode: RGB
DEBUG: Image shape: (480, 640, 3), dtype: uint8
ERROR: Error during face recognition: Unsupported image type, must be 8bit gray or RGB image.
INFO: 127.0.0.1 - - [27/Jun/2024 22:23:00] "POST /login HTTP/1.1" 200 -

@dannamado
Copy link

version de reconnaissance faciale : 1.3.0
Version Python : 3.12.4
systeme d'exploitation :windows 10

j'essaie d'implementer un systeme de reconnaissaance faciale a l'aide de la bibliotheque face_recognition . Cependant, je rencontre systématiquement l'erreur Type d'image non pris en charge, doit être une image grise ou RVB 8 bits, même si je m'assure que l'image est au bon format.

@Anan51
Copy link

Anan51 commented Jul 24, 2024

Hello! I've run into this issue a lot of times, and what worked for me was downgrading to numpy 1.26.1. Numpy 2 seems to have changed some functionality which causes this issue. Once you've downgraded your numpy, make sure to change the line containing "rgb_small_frame" to be:
rgb_small_frame = np.ascontiguousarray(small_frame[:, :, ::-1])
instead.

@Meghaa702
Copy link

Hello! I've run into this issue a lot of times, and what worked for me was downgrading to numpy 1.26.4. Numpy 2 seems to have changed some functionality which causes this issue. Once you've downgraded your numpy, it's working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants