insightface icon indicating copy to clipboard operation
insightface copied to clipboard

face detection and face verification inputs

Open marziehoghbaie opened this issue 4 years ago • 5 comments

Hi there, I just have a simple question, I like to know that the models inputs are in RGB or BGR??

marziehoghbaie avatar Jan 11 '21 11:01 marziehoghbaie

RGB in all of our models.

nttstar avatar Mar 02 '21 02:03 nttstar

https://github.com/deepinsight/insightface/search?q=ins_get_image Does it mean all these callings of ins_get_image(image) are incorrect? As to_rgb is False by default.

HuichuanLiu avatar Aug 03 '21 07:08 HuichuanLiu

RGB in all of our models.

Does it mean that we have to convert image from BGR to RGB and feed to FaceAnalysis.get function? https://github.com/deepinsight/insightface/blob/30295de48907e04077d6d22a9a8f580b525822ce/python-package/insightface/app/face_analysis.py#L58-L77

I want to know the input channel order for this specific function.

offchan42 avatar Feb 20 '23 15:02 offchan42

image From experimentation, it seems to me that FaceAnalysis.get() function probably accepts BGR format because I can see the sex and age prediction on this image correctly when I feed BGR format to the function. If I feed RGB format to the function, it predicts female for every face in this specific image. Please confirm that the get() function does indeed accept BGR format as input. Thanks.

offchan42 avatar Feb 20 '23 15:02 offchan42

I am going to necro this because its still unclear, in the examples it is shown using cv2.imread() which by default loads an image as BGR and then in the example that BGR image is fed to the model.

So is the example wrong?

If so I can open a PR to update it and also I can add a docblock to the function FacialAnalysis.get to explain what image type should be put in

lounging-lizard avatar Mar 24 '25 12:03 lounging-lizard