This project demonstrates how to use the RetinaFace library for face detection and facial landmark recognition in images. RetinaFace is a deep learning-based face detector that can accurately locate faces and key facial landmarks (such as eyes, nose, and mouth corners) in images. The script highlights detected faces and their landmarks on the input image.
- Detects all faces in an image
- Identifies facial landmarks: left eye, right eye, nose, mouth left, and mouth right
- Draws bounding boxes and landmark points on the image
python -m venv venv
.\venv\Scripts\activate
python3 -m venv venv
source venv/bin/activate
Install RetinaFace and OpenCV:
pip install retina-face opencv-python
- Place your input image in the project directory and update the
img_path
variable inretina_face.py
with the image filename. - Run the script:
python retina_face.py
The script will display the image with detected faces and facial landmarks highlighted.
Below is an example of the output result:
References: