Machine learning group 
Practical examples 
Scope 
We have covered some basic theory in our machine learning 
group but only a few of us have applied any of the tools. 
The next few weeks we are presenting some practical examples.
2 
Content 
Practical examples 
1. Numberplate recognition 
- Method 
- Code 
2. Face recognition 
- Method 
- Code 
Material from the book - Mastering OpenCV with practical computer 
vision examples, was used for this presentation.
3 
Examples 
1. Numberplate recognition 
Method 
SVM and Neural Networks 
1. Plate detection 
- Segmentation 
- Feature extraction 
- Classification 
- Results 
2. Plate recognition 
- Segmentation 
- Feature extraction 
- Classification 
- Results
4 
Examples
5 
1. Plate detection 
Examples 
- Segmentation 
- Feature extraction 
- Classification 
- Results
Sobel filter Threshold operation Close morphologic operation 
Mask of one filled area Detected plates after the 
6 
Possible detected plates 
marked in red (features images) 
SVM classifier 
Examples
7 
2. Plate recognition 
Examples 
- Segmentation (OCR segmentation) 
- Feature extraction 
- Classification 
- Results
8 
Examples
9 
1. Numberplate recognition 
Code 
Examples
10 
Examples 
2. Face recognition 
Method 
Eigenfaces or Fisherfaces 
1. Face detection 
2. Face preprocessing 
3. Training a machine-learning algorithm from collected faces 
4. Face recognition
11 
Examples 
2000 – Slow and Unreliable face detection 
2001 – Viola and Jones invented Haar-based cascade classifiers for object 
Detection. Big improvement especialy for real time application. 
2002 – Improved buy Lienhard and Maydt. 
2006 – LBP features by Ahonen Hadrd (Faster than Haar based features) 
LBP similar to Haar but uses histograms of pixel intensity comparisons.
12 
Examples 
Viola and Jones 
1. Grey scale image – intensity values from 0 to 255. 
2. The feature value is calculated as the sum of the pixel intensities in the 
light rectangle(s) minus the sum of the pixels in the dark rectangle(s) 
3. These adjacent blocks are known as ’features’.The value of the feature 
is then used in a filter to determine if that feature is present in the original 
image 
4. To make summing the intensity of the pixels in a given rectangle less 
computationally expensive and improve the speed, the integral image gets 
calculated (finding the area under a curve by adding together small 
rectangular areas) at every point. 
5. Learning. When there is no correlation between the feature identify-ing 
a face and it not being one, and vice versa it would be rejected.
Type of cascade classifier XML filename – OpenCV v2.4 
Face detector (default) haarcascade_frontalface_default.xml 
Face detector (fast Haar) haarcascade_frontalface_alt2.xml 
Face detector (fast LBP) lbpcascade_frontalface.xml 
Profile (side-looking) face detector haarcascade_profileface.xml 
Eye detector (separate for left and right) haarcascade_lefteye_2splits.xml 
Mouth detector haarcascade_mcs_mouth.xml 
Nose detector haarcascade_mcs_nose.xml 
Whole person detector haarcascade_fullbody.xml 
13 
Examples
14 
Examples 
Geometrical 
transformation 
and cropping 
Separate 
histogram 
equalization 
for left and 
right sides 
Smoothing 
bilateral 
filter 
Elliptical mask
15 
Examples 
Eigen Faces 
Fisher Faces
16 
Examples 
2. Face recognition 
Code
Thank you 
Name (email@csir.co.za)

Machine learning group - Practical examples

  • 1.
    Machine learning group Practical examples Scope We have covered some basic theory in our machine learning group but only a few of us have applied any of the tools. The next few weeks we are presenting some practical examples.
  • 2.
    2 Content Practicalexamples 1. Numberplate recognition - Method - Code 2. Face recognition - Method - Code Material from the book - Mastering OpenCV with practical computer vision examples, was used for this presentation.
  • 3.
    3 Examples 1.Numberplate recognition Method SVM and Neural Networks 1. Plate detection - Segmentation - Feature extraction - Classification - Results 2. Plate recognition - Segmentation - Feature extraction - Classification - Results
  • 4.
  • 5.
    5 1. Platedetection Examples - Segmentation - Feature extraction - Classification - Results
  • 6.
    Sobel filter Thresholdoperation Close morphologic operation Mask of one filled area Detected plates after the 6 Possible detected plates marked in red (features images) SVM classifier Examples
  • 7.
    7 2. Platerecognition Examples - Segmentation (OCR segmentation) - Feature extraction - Classification - Results
  • 8.
  • 9.
    9 1. Numberplaterecognition Code Examples
  • 10.
    10 Examples 2.Face recognition Method Eigenfaces or Fisherfaces 1. Face detection 2. Face preprocessing 3. Training a machine-learning algorithm from collected faces 4. Face recognition
  • 11.
    11 Examples 2000– Slow and Unreliable face detection 2001 – Viola and Jones invented Haar-based cascade classifiers for object Detection. Big improvement especialy for real time application. 2002 – Improved buy Lienhard and Maydt. 2006 – LBP features by Ahonen Hadrd (Faster than Haar based features) LBP similar to Haar but uses histograms of pixel intensity comparisons.
  • 12.
    12 Examples Violaand Jones 1. Grey scale image – intensity values from 0 to 255. 2. The feature value is calculated as the sum of the pixel intensities in the light rectangle(s) minus the sum of the pixels in the dark rectangle(s) 3. These adjacent blocks are known as ’features’.The value of the feature is then used in a filter to determine if that feature is present in the original image 4. To make summing the intensity of the pixels in a given rectangle less computationally expensive and improve the speed, the integral image gets calculated (finding the area under a curve by adding together small rectangular areas) at every point. 5. Learning. When there is no correlation between the feature identify-ing a face and it not being one, and vice versa it would be rejected.
  • 13.
    Type of cascadeclassifier XML filename – OpenCV v2.4 Face detector (default) haarcascade_frontalface_default.xml Face detector (fast Haar) haarcascade_frontalface_alt2.xml Face detector (fast LBP) lbpcascade_frontalface.xml Profile (side-looking) face detector haarcascade_profileface.xml Eye detector (separate for left and right) haarcascade_lefteye_2splits.xml Mouth detector haarcascade_mcs_mouth.xml Nose detector haarcascade_mcs_nose.xml Whole person detector haarcascade_fullbody.xml 13 Examples
  • 14.
    14 Examples Geometrical transformation and cropping Separate histogram equalization for left and right sides Smoothing bilateral filter Elliptical mask
  • 15.
    15 Examples EigenFaces Fisher Faces
  • 16.
    16 Examples 2.Face recognition Code
  • 17.
    Thank you Name(email@csir.co.za)

Editor's Notes

  • #18 <number>