From 622ef069ab27e49717f52b4635d45a25b1b3073f Mon Sep 17 00:00:00 2001 From: that-ar-guy Date: Thu, 16 Jan 2025 23:44:10 +0530 Subject: [PATCH 1/3] face detection model added --- .../computer-vision/face-detection.md | 178 ++++++++++++++++++ docs/projects/computer-vision/index.md | 13 ++ 2 files changed, 191 insertions(+) create mode 100644 docs/projects/computer-vision/face-detection.md diff --git a/docs/projects/computer-vision/face-detection.md b/docs/projects/computer-vision/face-detection.md new file mode 100644 index 00000000..50127cfe --- /dev/null +++ b/docs/projects/computer-vision/face-detection.md @@ -0,0 +1,178 @@ + + + + + +# Project Title +Face Detection using OpenCV + +### AIM +The goal of this project is to build a face detection system using OpenCV, which identifies faces in static images using Haar Cascades. + + +### DATASET LINK +For this project we are going to use the pretrained Haar Cascade XML file for face detection from OpenCV's Github repository. +[Click here to view the dataset](https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_default.xml) + + +### NOTEBOOK LINK +[Click here to view the notebook](https://colab.research.google.com/drive/1upcl9sa5cL5fUuVLBG5IVuU0xPYs3Nwf#scrollTo=94ggAdg5AnUk) + + +### LIBRARIES NEEDED + + + +??? quote "LIBRARIES USED" + + - OpenCV + - Numpy + - Matplotlib + +--- + +### DESCRIPTION +This project involves building a face detection model using OpenCV's pre-trained Haar Cascade Classifiers to detect faces in images. + +!!! info "What is the requirement of the project?" + - A face detection system is needed for various applications such as security, attendance tracking, and facial recognition systems. + - This project demonstrates a basic use of computer vision techniques for detecting faces in static images. + + +??? info "Why is it necessary?" + - Face detection is the first crucial step in many computer vision applications such as face recognition and emotion analysis. + - It is an essential component in systems that require human identification or verification. + +??? info "How is it beneficial and used?" + - Face detection can be used in automation systems, for example, in attendance tracking, photo tagging, and security surveillance. + - It enables various applications in user experience enhancement and biometric systems. + +??? info "How did you start approaching this project? (Initial thoughts and planning)" + - I began by exploring OpenCV documentation, focusing on how to implement Haar Cascade for face detection. + - Initially, I focused on static image detection, planning to extend the project to video-based detection in the future. + +??? info "Mention any additional resources used (blogs, books, chapters, articles, research papers, etc.)." + - OpenCV documentation + - Book: "Learning OpenCV 3" by Adrian Kaehler and Gary Bradski + +--- + +### EXPLANATION + +#### DETAILS OF THE DIFFERENT FEATURES + + - Haar Cascade Classifier: A machine learning-based approach for detecting objects in images or video. It works by training on a large set of positive and negative images of faces. + - Cascade Classifier*: The classifier works through a series of stages, each aimed at increasing detection accuracy. + - Face Detection: The primary feature of this project is detecting human faces in static images, which is the first step in many facial recognition systems. + + + +--- + +#### PROJECT WORKFLOW + + +=== "Step 1" + + Initial data exploration and understanding: + - Research the Haar Cascade method for face detection in OpenCV. + - Collect sample images for testing the model's performance. + + +=== "Step 2" + + Data cleaning and preprocessing: + - Ensure all input images are properly formatted (e.g., grayscale images for face detection). + - Resize or crop images to ensure optimal processing speed. + + +=== "Step 3" + + Feature engineering and selection: + - Use pre-trained Haar Cascade classifiers for detecting faces. + - Select the appropriate classifier based on face orientation and conditions (e.g., frontal face, profile). + + +=== "Step 4" + + Model training and evaluation: + - Use OpenCV's pre-trained Haar Cascade models. + - Test the detection accuracy on various sample images. + + +=== "Step 5" + + Model optimization and fine-tuning: + - Adjust parameters such as scale factor and minNeighbors to enhance accuracy. + - Experiment with different input image sizes to balance speed and accuracy. + + +=== "Step 6" + + Validation and testing: + - Validate the model's effectiveness on different test images, ensuring robust detection. + - Evaluate the face detection accuracy based on diverse lighting and image conditions. + + +--- + +#### PROJECT TRADE-OFFS AND SOLUTIONS + + +=== "Trade Off 1" + - Accuracy vs. computational efficiency. + - Solution: Fine-tuned classifier parameters to ensure a balance between accuracy and speed. + +=== "Trade Off 2" + - Detection performance vs. image resolution. + - Solution: Optimized input image resolution and processing flow to ensure both fast processing and accurate detection. + +--- + +### SCREENSHOTS + + +!!! success "Project workflow" + + ``` mermaid + graph LR + A[Start] --> B{Face Detected?} + B -->|Yes| C[Mark Face] + C --> D[Display Result] + B -->|No| F[Idle/Do Nothing] + ``` + +--- + +### CONCLUSION + +#### KEY LEARNINGS + +!!! tip "Insights gained from the data" + - Gained an understanding of face detection using Haar Cascades. + - Improved ability to optimize computer vision models for accuracy and speed. + +??? tip "Improvements in understanding machine learning concepts" + - Learned how to handle trade-offs between accuracy and speed in real-time applications. + - Gained hands-on experience with the implementation of object detection algorithms. + +??? tip "Challenges faced and how they were overcome" + - Challenge: Low detection accuracy in poor lighting conditions. + - Solution: Adjusted classifier parameters and added preprocessing steps to improve accuracy. + +--- + +#### USE CASES + + +=== "Application 1" + + **Security Surveillance Systems** + + - Used for identifying individuals or monitoring for intruders in secure areas. + +=== "Application 2" + + **Attendance Systems** + + - Used to automate attendance tracking by detecting the faces of students or employees. \ No newline at end of file diff --git a/docs/projects/computer-vision/index.md b/docs/projects/computer-vision/index.md index 1ba7b3c8..2780e68a 100644 --- a/docs/projects/computer-vision/index.md +++ b/docs/projects/computer-vision/index.md @@ -1,2 +1,15 @@ # Computer Vision 🎥 +
+ + + + OpenCV Logo +
+

Face Detection Model

+

Detecting faces in images using OpenCV's powerful Haar cascades.

+

📅 2025-01-16 | ⏱️ 10 mins

+
+
+ +
From 392dab0ce88faaec4f2767e3f50d9695b8390fd1 Mon Sep 17 00:00:00 2001 From: that-ar-guy Date: Fri, 17 Jan 2025 00:01:51 +0530 Subject: [PATCH 2/3] title corrected --- docs/projects/computer-vision/face-detection.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/projects/computer-vision/face-detection.md b/docs/projects/computer-vision/face-detection.md index 50127cfe..cccdfed6 100644 --- a/docs/projects/computer-vision/face-detection.md +++ b/docs/projects/computer-vision/face-detection.md @@ -3,8 +3,8 @@ -# Project Title -Face Detection using OpenCV +# Face Detection using OpenCV + ### AIM The goal of this project is to build a face detection system using OpenCV, which identifies faces in static images using Haar Cascades. From 189bccc48a3b75e41b836704bc8e788d1bc3aeb8 Mon Sep 17 00:00:00 2001 From: Mohammed Abdul Rahman <130785777+that-ar-guy@users.noreply.github.com> Date: Fri, 17 Jan 2025 18:54:36 +0530 Subject: [PATCH 3/3] title updated/comments removed/links updated --- .../computer-vision/face-detection.md | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/docs/projects/computer-vision/face-detection.md b/docs/projects/computer-vision/face-detection.md index cccdfed6..70916e08 100644 --- a/docs/projects/computer-vision/face-detection.md +++ b/docs/projects/computer-vision/face-detection.md @@ -1,9 +1,4 @@ - - - - - -# Face Detection using OpenCV +# Face Detection ### AIM @@ -12,21 +7,20 @@ The goal of this project is to build a face detection system using OpenCV, which ### DATASET LINK For this project we are going to use the pretrained Haar Cascade XML file for face detection from OpenCV's Github repository. -[Click here to view the dataset](https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_default.xml) + +[https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_default.xml](https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_default.xml) ### NOTEBOOK LINK -[Click here to view the notebook](https://colab.research.google.com/drive/1upcl9sa5cL5fUuVLBG5IVuU0xPYs3Nwf#scrollTo=94ggAdg5AnUk) +[https://colab.research.google.com/drive/1upcl9sa5cL5fUuVLBG5IVuU0xPYs3Nwf#scrollTo=94ggAdg5AnUk](https://colab.research.google.com/drive/1upcl9sa5cL5fUuVLBG5IVuU0xPYs3Nwf#scrollTo=94ggAdg5AnUk) ### LIBRARIES NEEDED - - ??? quote "LIBRARIES USED" - OpenCV - - Numpy + - Random - Matplotlib --- @@ -70,7 +64,6 @@ This project involves building a face detection model using OpenCV's pre-trained --- #### PROJECT WORKFLOW - === "Step 1" @@ -117,7 +110,6 @@ This project involves building a face detection model using OpenCV's pre-trained --- #### PROJECT TRADE-OFFS AND SOLUTIONS - === "Trade Off 1" - Accuracy vs. computational efficiency. @@ -130,7 +122,6 @@ This project involves building a face detection model using OpenCV's pre-trained --- ### SCREENSHOTS - !!! success "Project workflow" @@ -163,7 +154,6 @@ This project involves building a face detection model using OpenCV's pre-trained --- #### USE CASES - === "Application 1" @@ -175,4 +165,4 @@ This project involves building a face detection model using OpenCV's pre-trained **Attendance Systems** - - Used to automate attendance tracking by detecting the faces of students or employees. \ No newline at end of file + - Used to automate attendance tracking by detecting the faces of students or employees.