- Introduction
- Features
- Architecture
- Installation
- Usage
- Workspace Structure
- Models
- License
- Contributing
PhotoFaceDetect is a Python-based application designed for real-time face detection, tracking, and analysis. Leveraging powerful libraries like OpenCV and YOLOv3-tiny, this project offers multiple scripts to cater to various face detection and processing needs. Whether you're capturing faces from your desktop screen or streaming from a webcam, PhotoFaceDetect provides efficient and customizable solutions.
- Real-Time Face Detection: Utilize OpenCV's DNN module and YOLOv3-tiny for efficient face detection.
- Multithreading Optimization: Enhance performance using Python's
concurrent.futures
. - Customizable Scripts: Multiple scripts available for different face detection approaches.
- Model Integration: Supports various pre-trained models for age and gender detection.
- Automated Photo Capture: Save detected faces as separate image files with ease.
- Python 3.8 or higher
- pip package manager
git clone https://github.com/mbn-code/PhotoFaceDetect.git
cd PhotoFaceDetect
pip install -r requirements.txt
The project relies on several pre-trained models located in the models
directory. Ensure you have the following files:
deploy.prototxt
res10_300x300_ssd_iter_140000.caffemodel
yolov3-tiny.cfg
yolov3-tiny.weights
coco.names
You can download these models from their respective official sources:
Place the downloaded files in the models
directory.
To start the application, use the provided run.sh
script. This script allows you to select and execute different face detection and processing scripts.
./run.sh
The run.sh
script provides the following options:
-
Run faceMeshPro_desk_GPU
- Executes:
src/faceMeshPro_desk_GPU.py
- Description: Captures frames from the desktop screen and performs face detection using GPU acceleration.
- Executes:
-
Run faceMesh
- Executes:
faceMesh.py
- Description: Utilizes YOLOv3-tiny for real-time face detection from a webcam stream.
- Executes:
-
Run faceDeteID
- Executes:
faceDeteID.py
- Description: Detects faces and performs ID tracking with real-time display.
- Executes:
-
Run faceDeteIDphoto
- Executes:
faceDeteIDphoto.py
- Description: Detects faces from a video stream and saves them as photos.
- Executes:
-
Run faceDetePro
- Executes:
faceDetePro.py
- Description: Advanced face detection with multiple processing layers.
- Executes:
-
Run faceDetePro2
- Executes:
faceDetePro2.py
- Description: Enhanced face detection with skin color analysis.
- Executes:
-
Run faceMesh_pro_video
- Executes:
faceMesh_pro_video.py
- Description: Processes video streams for professional-grade face detection.
- Executes:
-
Run YOLOv3-tiny Face Detection
- Executes:
src/yolov3_tiny_face_detection.py
- Description: Implements YOLOv3-tiny for efficient face detection.
- Executes:
-
Exit
- Exits the application.
Upon running, you'll be prompted to select an option:
========================================
Welcome to the Face Detection App
========================================
Please select an option:
1) Run faceMeshPro_desk_GPU
2) Run faceMesh
3) Run faceDeteID
4) Run faceDeteIDphoto
5) Run faceDetePro
6) Run faceDetePro2
7) Run faceMesh_pro_video
8) Run YOLOv3-tiny Face Detection
0) Exit
Enter your choice:
PhotoFaceDetect/
├── assets/
│ └── images/
├── coco/
│ └── coco.names
├── models/
│ ├── age_net.caffemodel
│ ├── deploy_age.prototxt
│ ├── deploy_gender.prototxt
│ ├── deploy.prototxt
│ ├── gender_net.caffemodel
│ ├── model_CNN_V2.h5
│ ├── res10_300x300_ssd_iter_140000.caffemodel
│ ├── yolov3-tiny.cfg
│ └── yolov3-tiny.weights
├── src/
│ ├── faceDeteID.py
│ ├── faceDeteIDphoto.py
│ ├── faceDetePro.py
│ ├── faceDetePro2.py
│ ├── faceMesh_pro_desk_GPU.py
│ ├── faceMesh_pro_video.py
│ ├── faceMesh.py
│ └── ...
├── .gitignore
├── README.md
├── requirements.txt
└── run.sh
assets/
: Contains static assets like images used in the project.coco/
: Holds the COCO class labels file (coco.names
).detected_faces/
: Directory where detected face images are stored.face_photo/
: Stores saved face photos.models/
: Contains pre-trained models and their configuration files.src/
: Source code for various face detection and processing scripts..gitignore
: Specifies files and directories to be ignored by Git.README.md
: Project documentation.requirements.txt
: Lists Python dependencies.run.sh
: Bash script to execute different scripts based on user input.
The models directory includes several pre-trained models essential for face detection and analysis:
deploy.prototxt
res10_300x300_ssd_iter_140000.caffemodel
yolov3-tiny.cfg
yolov3-tiny.weights
deploy_age.prototxt
deploy_gender.prototxt
age_net.caffemodel
gender_net.caffemodel
model_CNN_V2.h5
Ensure all models are properly placed in the models
directory for the scripts to function correctly.
This project is licensed under the MIT License.
Contributions are welcome! Please follow these steps:
- Fork the Repository
- Create a Feature Branch
git checkout -b feature/YourFeature
- Commit Your Changes
git commit -m "Your Message"
git push origin feature/YourFeature
- Open PR