_____ _ _
| ___|_ _ ___ ___ _____ _| |_ _ __ __ _ ___| |_ ___ _ __
| |_ / _` |/ __/ _ \_____ / _ \ \/ / __| '__/ _` |/ __| __/ _ \| '__|
| _| (_| | (_| __/_____| __/> <| |_| | | (_| | (__| || (_) | |
|_| \__,_|\___\___| \___/_/\_\\__|_| \__,_|\___|\__\___/|_|
The Face Extractor is a Python script that automates the process of detecting and extracting faces from images. It utilizes the MTCNN (Multi-task Cascaded Convolutional Networks) algorithm for robust face detection and cropping.
- Automatic face detection and cropping from all images in specified folder.
- Adjustable padding ratio around detected faces.
- Customizable confidence threshold for controlling face detection sensitivity.
- Supports various image formats including JPG, JPEG, and PNG.
- Output folder organization: Each extracted face is saved with a unique identifier and placed in the output folder.
- MTCNN: Multi-task Cascaded Convolutional Networks for face detection.
- OpenCV: Open Source Computer Vision Library.
- NumPy: Fundamental package for scientific computing with Python.
- Tensorflow: Free and open-source software library for machine learning and artificial intelligence.
- Clone the repository:
https://github.com/sankeer28/Face-Extractor.git
- Install the required Python packages:
pip install -r requirements.txt
options:
-h, --help show this help message and exit
--input INPUT Path to the input folder.
--output OUTPUT Path to the output folder.
--padding PADDING Padding ratio around the face (default: 0.2)
--confidence_threshold Confidence threshold for face detection (default: 0.8)
--annotate Add numbers to detected faces on the output images.
--input
: Path to the input folder containing images.--output
: Path to the output folder where extracted faces will be saved.--padding
: Padding ratio around the detected faces (default: 0.2).--confidence_threshold
: Confidence threshold for face detection (default: 0.8).--annotate
: Add numbers to detected faces on the output images.
Extract faces from images in the input
folder and save them to the output
folder with default settings:
python face_extractor.py --input input --output output
- after running
python face_extractor.py --input "C:\Users\san\Downloads\Face-Extractor" --output "C:\Users\san\Downloads\Face-Extractor\out"
- after running
python face_extractor.py --input "C:\Users\san\Downloads\Face-Extractor" --output "C:\Users\san\Downloads\Face-Extractor\out" --annotate
80 faces were found
This project is licensed under the MIT License - see the LICENSE file for details.