Remove extra BGR2RGB call in RetinaFaceWrapper

I suggest removing the extra BGR2RGB call.

While the RetinaFace model does expect RGB images, the corresponding conversion will be done in the RetinaFace preprocessing:
0c8d3ed8bd/retinaface/commons/preprocess.py (L45)

The extra BGR2RGB call here will in fact make the final channel order wrong, because OpenCV does not know about the channel order, each call will simply swap the channels.

Thanks!
This commit is contained in:
Bosco Yung 2021-11-10 16:01:51 +08:00 committed by GitHub
parent 08fd823866
commit 9b816648e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,8 @@ def detect_face(face_detector, img, align = True):
resp = []
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #retinaface expects RGB but OpenCV read BGR
# The BGR2RGB conversion will be done in the preprocessing step of retinaface.
# img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #retinaface expects RGB but OpenCV read BGR
"""
face = None