Skip to content

dhruv-gupta-dev/Face_Detection_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-Time Face Detection using OpenCV DNN 📸

Python OpenCV Status

A lightweight, real-time face detection application built with Python and OpenCV. It utilizes a pre-trained Caffe Deep Neural Network (SSD ResNet-10) for high-accuracy detection, significantly outperforming standard Haar Cascades.

🚀 Features

  • Real-Time Detection: Processes webcam feed instantly.
  • High Accuracy: Uses a DNN (Deep Neural Network) model rather than older cascade classifiers.
  • Confidence Filtering: Only displays detections with >60% confidence to reduce false positives.
  • Auto-Save: Automatically crops and saves detected faces to a local folder for dataset creation.
  • Live Stats: Displays real-time FPS (Frames Per Second) and face count on screen.

🛠️ Installation

  1. Clone the repository

    git clone https://github.com/dhruv-gupta-dev/Face_Detection_Project.git
    cd Face_Detection_Project
  2. Install Dependencies

    pip install -r requirements.txt
  3. Download Models Ensure you have the following Caffe model files inside a models/ folder in the root directory:

    • deploy.prototxt
    • res10_300x300_ssd_iter_140000.caffemodel

    (Note: These files are required for the DNN module to work.)

💻 Usage

Run the main script:

python face_detection.py
  • Press q to quit the application.

  • Saved Faces: Check the saved_faces/ directory to see crops of detected faces.

📂 Project Structure

Plaintext
├── models/                  # Caffe model files (prototxt & caffemodel)
├── saved_faces/             # Auto-generated folder for face crops
├── face_detection.py        # Main application script
├── requirements.txt         # Python dependencies
└── README.md                # Project documentation

🧠 How it Works

The application uses OpenCV's DNN module to load a pre-trained Single Shot Detector (SSD) model with a ResNet-10 architecture. It resizes video frames to 300x300 blobs, passes them through the network, and filters out weak predictions based on the confidence threshold.

  • Built by Dhruv Gupta

About

Real-time face detection with OpenCV DNN (Caffe SSD-ResNet10), live FPS/face count, and automatic face-crop saving from webcam streams.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages