A python program that detects all human faces in an image and crops them automatically.
The best practice for your project is to use a virtual environment.
git clone https://github.com/Nimon77/face-auto-crop.git
You can use pyenv to have multiple python version on your system and make venv with pipenv
pip install --user pipenv
cd face-auto-crop
pipenv install
pipenv shell
cd face-auto-crop
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cd face-auto-crop
pip install -r requirements.txt
usage: auto_crop.py [-h] [-t THREAD] [-o OUTPUT] image [image ...]
Auto crop faces from images.
positional arguments:
image image file or directory path
options:
-h, --help show this help message and exit
-t THREAD, --thread THREAD
number of threads (default: 1)
-o OUTPUT, --output OUTPUT
output directory (default: result)
python auto_crop.py images/peoples.jpg
or
python auto_crop.py image/peoples.jpg data/group.png human.jpeg
or
python auto_crop.py -t 4 images/
Successfully cropped images will be saved in a folder named "result" or in the output directory if specified