Skip to content

About

MLPR lab submissions - Shloka Srivastava (U20240131)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Machine Learning and Pattern Recognition

Lab 5

Shloka Srivastava (ID: U20240131)


Aim

The aim of this lab is to:

  • Detect faces in images
  • Extract simple color features from faces
  • Group faces using KMeans clustering
  • Classify a new face using a template image
  • Visualize the clustering results

Method

1. Face Detection

  • Haar Cascade classifier was used.
  • Faces were detected in:
    • A group faculty image
    • A template image
  • Rectangles were drawn around detected faces.

2. Feature Extraction

For each detected face:

  • The face region was cropped.
  • The image was converted from BGR to HSV format.
  • Mean Hue and Saturation values were calculated.
  • Each face was represented as a 2D point

3. KMeans Clustering

  • KMeans algorithm was applied with k = 2.
  • Faces were divided into two clusters.
  • Cluster centers (centroids) were calculated.
  • Results were plotted in 2D space.

4. Template Face Classification

  • A template face image was processed the same way.
  • Hue and Saturation values were calculated.
  • The template was assigned to the nearest cluster.
  • The result was shown in the feature plot.

Results

1. Face Detection on Group Image

30 faces were detected successfully.

detected_faces


2. Face Clustering (Hue vs Saturation)

Each face was plotted as a point in 2D space. image


3. KMeans Clustering with Centroids

Faces were grouped into two clusters and centroids were shown. image


4. Template Face in Feature Space

Template face was plotted with other faces.

image

5. Final Classification Result

Template face was assigned to the nearest cluster.

image

Key Observations

  • Haar Cascade detected faces correctly.
  • Hue and Saturation gave a simple 2D representation of faces.
  • KMeans successfully grouped faces into two color-based clusters.
  • The template face was classified based on similarity to cluster centers.
  • 2D plots clearly showed cluster separation.

Conclusion

In this lab:

  • Face detection was done using classical computer vision.
  • Simple color features (Hue and Saturation) were used.
  • KMeans grouped faces based on color similarity.
  • A new face was classified using cluster distance.

This experiment shows how basic computer vision and machine learning techniques can be combined for simple face grouping and classification.

About

MLPR lab submissions - Shloka Srivastava (U20240131)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages