DidMatTech 2020 Conference
Using SL methods for skin segmentation
Comparison between SVM, KNN, NB, DT and LR in the RGB and YCbCr color spaces with and without dropping duplicated records for different evaluation criteria
https://www.researchgate.net/publication/341281794_Supervised_learning_methods_for_skin_segmentation_classification
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Supervised learning methods for skin segmentation based on color pixel classification
1. Introduction
Background
Experiments
Results and Conclusion
Supervised learning methods for skin segmentation
based on color pixel classification
XXXIII. DidMatTech 2020
Ahmad Taan and Zakarya Farou
Eötvös Loránd
Tudományegyetem
June 26, 2020
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
2. Introduction
Background
Experiments
Results and Conclusion
Table of Contents
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
3. Introduction
Background
Experiments
Results and Conclusion
Skin Segmentation
Applications
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
4. Introduction
Background
Experiments
Results and Conclusion
Skin Segmentation
Applications
Skin Segmentation
Skin Segmentation
Extraction of skin regions from colored images for further image
processing
Color Pixel Classification
Relying on the color of individual pixels to classify them into skin
and non-skin
Only 0.02% of data records in the RGB skin data set where
found common between skin and non-skin
Due to the complex mathematical relations between color
components, using SL methods is proposed
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
5. Introduction
Background
Experiments
Results and Conclusion
Skin Segmentation
Applications
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
6. Introduction
Background
Experiments
Results and Conclusion
Skin Segmentation
Applications
Applications
Figure 1: Computer Vision1
Figure 2: Tumor Detection2
1
[https://www.youtube.com/watch?v=IkgM1b1HLK0&feature=emb_title]
2
[https://www.visualsonics.com/sites/default/files/styles/manual_crop/public/media-files/5R-48hrs-UNMI
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
7. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
8. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
SL Algorithms
Figure 3: Machine Learning Algorithms
Machine Learning (ML)
A form of artificial intelligence
that enables a system to learn
from data rather than through
explicit programming
Supervised Learning (SL)
A machine is trained on labelled
data to produce a model that can
predict labels for new unlabelled
inputs
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
9. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Support Vector Machine (SVM)
Figure 4: Optimal hyperplane separating
data set classes
The goal is to find the
optimal separating
hyperplane which maximizes
the margin of the training
data
Kernelling can be used to
map the data into higher
dimensions if the data is not
linearly separable
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
10. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
K-Nearest Neighbors (KNN)
Figure 5: KNN with K=5
Classifying new inputs by
considering classes of the K
nearest neighbors
It is a lazy learning algorithm
as it memories the labelled
data set entries and
compares them to new
inputs at the prediction time
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
11. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Naïve Bayes (NB)
Bayes’ Theorem
P(y|X) =
P(X|y) × P(y)
P(X)
(1)
Where:
X = (x1, x2, x3, ..., xN) is the
features vector
y is the output class label
The goal is to find y that
maximizes P(y|X) for a
given X
Naïve comes from the
assumption of independence
between features so that
P(X|y) =
P(x1|y) × P(x2|y) ×
P(x3|y) × ... × P(xN|y)
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
12. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Decision Tree (DT)
Root
Node
Leaf
Node
Internal
Node
Internal
Node
Leaf
Node
Leaf
Node
Leaf
Node
Figure 6: Decision Tree
Nodes are split successively
into smaller nodes by
applying threshold tests
starting from the root node
until reaching the leaf nodes
where class labels are
determined
It mimics the human logic of
thinking based on
if-then-else rules structure
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
13. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Logistic Regression (LR)
y =
0 if σ(yL(X)) < φ
1 else
(2)
yL = β0 + β1x1 + β2x2 + ... + βnxN (3)
σ (x) =
1
1 + e−x
(4)
Where:
y is the output class label
yL is the linear model
X = (x1, x2, x3, ..., xN) is the features vector
φ is the threshold value
σ is the sigmoid (logistic) function
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
14. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Logistic Regression (LR)
Figure 7: LR vs Linear Regression
The machine learns the
lineal model parameters βi
by considering the sigmoid
function values as the
predicted values of class
labels
Equation (2) is the LR
equation that is used to
predict class labels for new
unlabelled data records
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
15. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
16. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Color Spaces
Representing color information with numerical values
RGB defines color by Red, Green, and Blue components. Each
value carries intensity (luminance) and color (chrominance)
information.
YCbCr separates luminance (Y ) and chrominance (Cb and Cr)
which is considered more perceptual.
RGB to YCbCr Conversion
Y =
77
256
R +
150
256
G +
29
256
B (5)
Cb = B − Y (6)
Cr = R − Y (7)
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
17. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
18. Introduction
Background
Experiments
Results and Conclusion
SL Algorithms
Color Spaces
Related Works
Related Works
Some researchers focused on color models to improve skin
detection accuracy, whereas others argued it is irrelevant.
A comparison between RGB, YCbCr, and HSV color spaces
was done to prove that an optimal skin model can be achieved
for each color space.
Some methods rely on statistics and probability concepts,
such as using look-up tables of skin color probabilities where
no mathematical calculations are involved in contrast to
distance-based approaches that make execution time
drastically higher
Skin region detection using ML algorithms such as SVM and
convolutional neural networks (CNN)
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
19. Introduction
Background
Experiments
Results and Conclusion
Data Set
Preprocessing
SL Training Configuration
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
20. Introduction
Background
Experiments
Results and Conclusion
Data Set
Preprocessing
SL Training Configuration
Data Set
The skin segmentation data set is publicly available in the UCI
repository
Records are RGB values of pixels taken randomly from human
face images with binary labels referring to skin (1) and non-skin
(0)
Sample size is 245057 with 21% skin and 79% non-skin samples
The data set includes duplicated records with 51444 unique
ones (28% skin and 72% non-skin)
Only 11 distinct RGB tuples refer to both skin and non-skin at
the same time
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
21. Introduction
Background
Experiments
Results and Conclusion
Data Set
Preprocessing
SL Training Configuration
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
22. Introduction
Background
Experiments
Results and Conclusion
Data Set
Preprocessing
SL Training Configuration
RGB Density Plots
Figure 8: RGB Density Plots of Skin and Non-skin
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
23. Introduction
Background
Experiments
Results and Conclusion
Data Set
Preprocessing
SL Training Configuration
YCbCr Density Plots
Figure 9: YCbCr Density Plots of Skin and Non-skin
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
24. Introduction
Background
Experiments
Results and Conclusion
Data Set
Preprocessing
SL Training Configuration
Pair-plots of RGB and YCbCr
Figure 10: RGB and YCbCr Pair-plots of Skin (in orange) and Non-skin (in green)
Without Duplicates
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
25. Introduction
Background
Experiments
Results and Conclusion
Data Set
Preprocessing
SL Training Configuration
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
26. Introduction
Background
Experiments
Results and Conclusion
Data Set
Preprocessing
SL Training Configuration
SL Training Configuration
The sklearn library implementations of the selected SL methods
were used with the default parameters.
Classifier Algorithm Parameters
SVM sklearn.svm.LinearSVC loss=squared_hinge C=1
KNN sklearn.neighbors.KNeighborsClassifier n_neighbors=5 p=2
NB sklearn.naive_bayes.GaussianNB var_smoothing=1e-9
DT sklearn.tree.DecisonTreeClassifier criterion=gini
LR sklearn.linear_model.LogisticRegression penalty=l2
Table 1: Parameters settings of the classifiers used in the experiments
The models were trained on the data records in the RGB and
YCbCr color spaces, with and without duplicates filtering.
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
27. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
28. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Threshold Metrics
Threshold metrics are concerned about quantifying the error in
prediction.
Predicted as Positive Predicted as Negative
Actually Positive True Positives (TP) False Negatives (FN)
Actually Negative False Positives (FP) True Negatives (TN)
Table 2: Confusion matrix
Metric Definition
Accuracy (ACC) (TP + TN)/(TP + FP + FN + TN)
Precision (P) TP/(TP + FP)
Recall (R) TP/(TP + FN)
F1-Score (F1) P × R/(P + R)
Table 3: Binary threshold metrics
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
29. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ranking Metrics
Ranking metrics are concerned about class separation. They are
quantified by the Area Under Curve concept (AUC), where the curves are
generated by changing the discrimination threshold of the models.
Figure 11: ROC and PR curves
FPR =
FP
FP + TN
(8)
TPR =
TP
TP + FN
(9)
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
30. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
31. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Experimental Results
Model
With duplicates Without duplicates Color
spaceTP FP TN FN TP FP TN FN
SVC 16292 7422 186776 34567 751 1623 35167 13903
RGB
KNN 49749+
908 193290 1110−
14362+
721 36069 292−
NB 37115 5202 188996 13744 10789 3608 33182 3865
DT 45864 901−
193297+
4995 13338 467−
36323+
1316
LR 40236 11585 182613 10623 8720 5333 31457 5934
SVC 31163 11555 182643 19696 8055 6370 30420 6599
YCbCr
KNN 49999+
659 193539 860−
14366+
537 36253 288−
NB 46163 1669 192529 4696 13408 321 36469 1246
DT 46779 220−
193978+
4080 13673 188−
36602+
981
LR 40199 11470 182728 10660 8707 5342 31448 5947
SVC 30362 19114 175084 20497 2931 7310 29480 11723
CbCr
KNN 47519+
355 193843 3340−
14010+
283 36507 644−
NB 46172 2194 192004 4687 13275 327 36463 1379
DT 47334 296−
193902+
3525 13341 239−
36551+
1313
LR 37600 12618 181580 13259 4959 5738 31052 9695
Table 4: Confusion Matrix Entries for all the experiments
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
32. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Experimental Results
Table 4 shows that KNN is the best in detecting the
minority class while DT in detecting the majority class.
In table 2, DT appears only once as the best classifier, so the
confusion matrix is not sufficient for the decision.
The confusion matrix can be used to derive threshold metrics.
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
33. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Experimental results
Model
With duplicates Without duplicates Color
space
ACC F1
ROC-
AUC
PR-
AUC
ACC F1
ROC-
AUC
PR-
AUC
SVC 82.87 35.9 90.8 68.07 69.82 6.67 79.32 51.59
RGB
KNN 99.18 97.98 99.18 98.03 98.03 96.59 98.93 96.64
NB 92.27 77.49 93.61 84.45 85.47 73.27 93.13 85.9
DT 97.59 93.2 94.86 90.53 96.53 93.47 94.92 90.59
LR 90.94 77.63 94.59 70.51 78.1 59.28 85.79 63.7
SVC 87.25 58.85 94.93 71.25 74.79 41.87 85.95 63.52
YCbCr
KNN 99.38 98.49 99.4 98.39 98.4 97.2 98.97 96.81
NB 97.4 92.71 99.75 98.51 96.95 94.24 99.6 98.57
DT 98.25 95.25 95.95 93.24 97.73 95.84 96.45 94.04
LR 90.97 77.66 94.58 70.44 78.06 59.15 85.79 63.68
SVC 83.84 48.95 94.39 67.19 63 11.63 83.81 60.68
CbCr
KNN 98.49 95.85 97.37 95.46 98.2 96.78 98.46 96.71
NB 97.19 92.21 99.75 98.55 96.68 93.8 99.62 98.47
DT 98.44 95.94 96.7 94.4 96.98 94.46 95.69 92.8
LR 89.44 73.88 94.05 67.89 70 33.78 84.74 62.02
Table 5: Summary of experimental results considering different metrics
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
34. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Experimental Results
Table 5 shows that KNN and NB share the best values for all
the metrics, so they are used to test the effect of color spaces and
duplicates.
YCbCr is the best color space overall.
The intensity (Y) is important for KNN but has negligible effect on
NB.
Duplicates dismissal gives worse results for KNN but slightly
changes the results of NB up and down.
KNN is the best considering threshold metrics (99.38%
accuracy and 98.49% F1-score) while NB is the best in terms of
ranking metrics (99.75% ROC-AUC and 98.57% PR-AUC).
KNN is the best overall as it gives comparable results to NB in
terms of ranking metrics.
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
35. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Experimental results
KNN is the worst in terms of execution time as it involves a
lot of mathematical calculations at the prediction time, which is not
preferred in real-time applications.
Figure 12: Graphical representation of the achieved results in terms of execution time
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
36. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Index
1 Introduction
Skin Segmentation
Applications
2 Background
SL Algorithms
Color Spaces
Related Works
3 Experiments
Data Set
Preprocessing
SL Training Configuration
4 Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
37. Introduction
Background
Experiments
Results and Conclusion
Evaluation Metrics
Experimental Results
Conclusion
Conclusion
YCbCr is better than RGB for skin segmentation.
The intensity (Y) importance is relevant to the algorithm used,
for instance, KNN performs better considering the intensity (Y), but
NB is almost not influenced by it.
Duplicates’ influence is also relevant to the algorithm used.
KNN performs better with duplicates while NB almost gives even
results.
The best SL model in almost all the cases considered is KNN.
Evaluation metrics are crucial for finding the superior SL model.
KNN is the best considering threshold metrics while NB is the best
in terms of ranking metrics.
Execution time is an important factor, KNN algorithm is the
worst in this regard.
Ahmad Taan and Zakarya Farou Supervised learning methods for skin segmentation based o
38. Thank you
This project has been supported by Telekom Innovation Laboratories (T-Labs),
the Research and Development unit of Deutsche Telekom.