You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect the image format to be consistent regardless of detector_backend.
What happened instead?
When detector_backend is "skip" the final image used for the embedding is in "RGB" format.
When detector_backend is any other valid option, like "retinaface" the final image used for the embedding is in "BGR" format.
Additional Info
When using detector_backend="skip":
The image is loaded using image_utils.load_image. (here)
The image is in "BGR" format.
The image format is swapped using img = img[:, :, ::-1]. (here)
The image is in "RGB" format.
The image embedding is calculated.
When using any other detector_backend:
detection.extract_faces is called.
The color_face argument is defaulted to "rgb"
The image is loaded using image_utils.load_image. (here)
The image is now in "BGR" format.
The color_face argument is "rgb" so the format is swapped using current_img = current_img[:, :, ::-1]. (here)
The image is now in "RGB" format.
The format is swapped again within represent using img = img[:, :, ::-1]. (here)
The image is now in "BGR" format.
The image embedding is calculated.
The text was updated successfully, but these errors were encountered:
dakotah-jones
changed the title
[BUG]: Image format (RGB/BRG) is inconsistent when using DeepFace.represent
[BUG]: Image format (RGB/BGR) is inconsistent when using DeepFace.represent
Jan 15, 2025
Before You Report a Bug, Please Confirm You Have Done The Following...
DeepFace's version
v0.0.93
Python version
3.12.8
Operating System
Ubuntu 20.04.6 LTS
Dependencies
N/A
Reproducible example
Relevant Log Output
N/A
Expected Result
I expect the image format to be consistent regardless of
detector_backend
.What happened instead?
When
detector_backend
is"skip"
the final image used for the embedding is in"RGB"
format.When
detector_backend
is any other valid option, like"retinaface"
the final image used for the embedding is in"BGR"
format.Additional Info
When using
detector_backend="skip"
:image_utils.load_image
. (here)"BGR"
format.img = img[:, :, ::-1]
. (here)"RGB"
format.When using any other
detector_backend
:detection.extract_faces
is called.color_face
argument is defaulted to"rgb"
image_utils.load_image
. (here)"BGR"
format.color_face
argument is "rgb" so the format is swapped usingcurrent_img = current_img[:, :, ::-1]
. (here)"RGB"
format.represent
usingimg = img[:, :, ::-1]
. (here)"BGR"
format.The text was updated successfully, but these errors were encountered: