https://github.com/sankeer28/face-extractor
Python script that automates the process of detecting and extracting faces from images using MTCNN algorithm
https://github.com/sankeer28/face-extractor
face-detection face-recognition osint-python python
Last synced: over 1 year ago
JSON representation
Python script that automates the process of detecting and extracting faces from images using MTCNN algorithm
- Host: GitHub
- URL: https://github.com/sankeer28/face-extractor
- Owner: sankeer28
- License: mit
- Created: 2024-06-03T15:59:55.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-03T18:29:44.000Z (about 2 years ago)
- Last Synced: 2024-06-04T18:55:19.840Z (about 2 years ago)
- Topics: face-detection, face-recognition, osint-python, python
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Face Extractor
```
_____ _ _
| ___|_ _ ___ ___ _____ _| |_ _ __ __ _ ___| |_ ___ _ __
| |_ / _` |/ __/ _ \_____ / _ \ \/ / __| '__/ _` |/ __| __/ _ \| '__|
| _| (_| | (_| __/_____| __/> <| |_| | | (_| | (__| || (_) | |
|_| \__,_|\___\___| \___/_/\_\\__|_| \__,_|\___|\__\___/|_|
```
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.
## Features
- 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.
## Uses
- [MTCNN](https://github.com/ipazc/mtcnn): Multi-task Cascaded Convolutional Networks for face detection.
- [OpenCV](https://opencv.org/): Open Source Computer Vision Library.
- [NumPy](https://numpy.org/): Fundamental package for scientific computing with Python.
- [Tensorflow](https://www.tensorflow.org/): Free and open-source software library for machine learning and artificial intelligence.
## Installation
1. Clone the repository:
```
https://github.com/sankeer28/Face-Extractor.git
```
2. Install the required Python packages:
```
pip install -r requirements.txt
```
## Usage
```
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.
## Examples
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
```
## Example
#### Input image:

#### 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
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.