https://github.com/freearhey/face-extractor
Python script that detect faces on the image or video, extracts them and saves to the specified folder
https://github.com/freearhey/face-extractor
Last synced: about 1 month ago
JSON representation
Python script that detect faces on the image or video, extracts them and saves to the specified folder
- Host: GitHub
- URL: https://github.com/freearhey/face-extractor
- Owner: freearhey
- License: mit
- Created: 2019-11-18T02:30:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-02T23:49:09.000Z (almost 2 years ago)
- Last Synced: 2025-02-03T22:29:53.889Z (4 months ago)
- Language: Python
- Size: 18.6 MB
- Stars: 34
- Watchers: 3
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# face-extractor

Python script that detect faces on the image or video, extracts them and saves to the specified folder.
## Installation
Copy repository to your computer using one of the available methods. For example, this can be done using the `git clone` command:
```sh
git clone https://github.com/freearhey/face-extractor.git
```Then you need to go to the project folder and install all the dependencies:
```sh
# change directory
cd face-extractor# install dependencies
pip install -r requirements.txt
```And you're done.
## Usage
To run the script you need to pass only the path to the image that need to be processed, as well as the path to the folder where the extracted faces will be saved.
```sh
python extract.py --input path/to/image.jpg --output path/to/output_folder
```The video file can also be used as the input:
```sh
python extract.py --input path/to/video.mp4 --output path/to/output_folder
```Or it could be a folder containing these files:
```sh
python extract.py --input path/to/folder_with_images
```By default, the files are saved in the `output` folder.
**Arguments:**
- `-h, --help`: show this help message and exit
- `-i, --input`: path to input directory or file
- `-o, --output`: path to output directory of faces
- `-p, --padding`: padding ratio around the face (default: 1.0)## Demo
In the `examples` folder you can find several images that can be processed using the script, like so:
```sh
python extract.py --input examples
```## Test
```sh
python -m pytest tests/
```## License
[MIT](LICENSE)