AI Algorithm - Detect Glasses
AI Algorithm - Detect Glasses
detection
AI project
By
Ahmed Fekry
Moaz Tarek
Agenda
0 0 Feature
ML vs AI
1 4 Extraction
0 0
Project Idea Classifiers
2 5
0 Data 0
Comparison
3 preparation 6
AI - layers
Artificial
intellige
nce
Machine
learning
Deep
learning
Machine Learning Infographics
Artificial Machine
Intelligence learning
● Computers act on their own Vs ● It’s an application of AI
● They act according to ● Computers observe and
environment analyze
● Systems display cognitive ● Predict based on previous
ability patterns
● Computers make decisions ● Pre-programmed algorithms
Idea of project
Comparison Classifiers
KNN & SVM & 0
between classifiers Adaboost 4
Logistic Regression
Train the
model 0
Labeling & Splitting 3
Feature
extraction 0
Dlib & HOG 2
Data
preparation 0
Balancing &
1
Resizing
Dataset
Kaggle
website
data-cleaning-
glasses-no-glasses
Link:
https://www.kaggle.com/datasets/jorgebuen
operez/datacleaningglassesnoglasses
Dataset details
1961
People wearing
glasses
2150
People not wearing
glaesses
We will use an 80/20 ratio (80% of pictures for training & validation and 20% for Testing)
Dlip
01 02
HOG + Linear
Max-Margin (MMOD) CNN
SVM
● dlib.get_frontal_face_detector() ● dlib.cnn_face_detection_model_v1
● Detecting frontal faces only Vs
(modelPath)
● based on Histogram of Oriented ● Detecting far and unclear
Gradients (HOG) features faces
Preparing Images
Loading
Resizing Labeling
No glasses & yes
By glob & os.listdir By cv.resize
glasses
Enhancing processed images
CLA
After using the median filter to blur and keep the HE
Filter
Points: 37 -- Points: 43 --
42 48 To make the Model detect if there are glasses or
not, it needs to detect the face first.
Using different
classifiers
Adaboost Ensemble modeling
Support Vector
SVM Machine
Logistic
Binary classification
Regreesion
k-Nearest Neighbors
Normalization is preferred
kNN classifier
Ada-boost
Using different
classifiers
Adaboost Ensemble modeling
Support Vector
SVM Machine
Logistic
Binary classification
Regreesion
kNN classifier
Ada-boost
SVM classifier
Logistic
Regression
Comparison between all classifiers
Without adding a line for the Gaussian filter before the CANNY line
Comparison between all classifiers
References
https://medium.com/mlearning-ai/glasses-dete
01 Guide ction-opencv-dlib-bf4cd50856da
https://thepythoncode.com/article/hog-feature
02 HOG feature -extraction-in-python
https://www.geeksforgeeks.org/boosting-in-ma
03 Adaboost chine-learning-boosting-and-adaboost/
https://www.geeksforgeeks.org/clahe-histogra
04 CLAHE m-eqalization-opencv/
05 Glob https://www.youtube.com/watch?v=aDyXKEZvBb0
THANK
YOU!