serengil / retinaface

RetinaFace: Deep Face Detection Library for Python
https://www.youtube.com/watch?v=Wm1DucuQk70&list=PLsS_1RYmYQQFdWqxQggXHynP1rqaYXv_E&index=3
MIT License
1.22k stars 154 forks source link

Drawing a Bounding Box Around the Detected Face #64

Closed varungupta31 closed 1 year ago

varungupta31 commented 1 year ago

I just need som information on what the function RetinaFace.detect_faces return.

{'face_1': {'score': 0.9993057250976562,
  'facial_area': [751, 294, 765, 312],
  'landmarks': {'right_eye': [757.8388, 301.72882],
   'left_eye': [763.83203, 301.46323],
   'nose': [762.1515, 305.3767],
   'mouth_right': [758.4781, 308.56125],
   'mouth_left': [763.1256, 308.4889]}}}

So if my image is 512x1024 (heightxwidth), what does these numbers (coordinates?) represent?

And my target is to draw a box around that detection, say using cv2.rectangle (either need top-left and bottom-right coordinates, or top-left and height and width), how would I do so? I tried playing around with the facial area key, but couldn't get the box around the face.

Also, landmarks is [757.8388, 301.72882], if this is a coordinate, 757 is already out of my image canvas (512)?

Just some basic doubts, thanks :)

serengil commented 1 year ago

these are directly x and y coordinates