This repository contains a Face Recognition System implemented using Supervised Machine Learning techniques.
The system uses Principal Component Analysis (PCA) for feature reduction and Support Vector Machine (SVM) for face classification.
The project is fully dynamic, allowing users to add new people, recreate the dataset, retrain the model, and test recognition results.
├── .ipynb_checkpoints/
│
├── train_data_2/ # Training face images
├── test_data/ # Testing face images
│
├── data.npy # PCA-transformed face features
├── target.npy # Class labels
│
├── haarcascade_frontalface_default.xml # Face detection model
│
├── fscrRecodDatasetMaking.ipynb # Dataset creation & feature extraction
├── trainModel(SVM).ipynb # PCA + SVM training
├── testModel.ipynb # Model testing
│
├── SVM-FaceRecognition.sav # Trained SVM model
└── README.md
- The system follows a supervised learning approach.
- Each face image is labeled with the corresponding person name.
- Labels are used to train the classifier.
- PCA is applied to:
- Reduce dimensionality
- Remove noise
- Improve training speed
- Converts face images into compact feature vectors.
- SVM is used as the final classifier.
- Learns decision boundaries between different individuals.
- Performs well on high-dimensional face data.
- Python
- OpenCV
- NumPy
- Scikit-learn
- Jupyter Notebook
train_data_2/
├── saman_kumara/
│ ├── img1.jpg
│ ├── img2.jpg
│ └── ...
├── kasun_perera/
└── nimal_silva/
test_data/
├── saman_kumara/
├── kasun_perera/
Each folder represents one class (one person).
This system supports dynamic training.
- Navigate to
train_data_2/ - Create a new folder with the person’s name
Example:
train_data_2/saman_kumara/
- Add multiple face images of that person.
Run:
fscrRecodDatasetMaking.ipynb
This will:
-
Detect faces
-
Apply PCA
-
Generate:
data.npytarget.npy
-
Open:
trainModel(SVM).ipynb -
Ensure the new person’s name is included in the label list.
-
Train the SVM classifier.
Output:
SVM-FaceRecognition.sav
-
Add images to:
test_data/saman_kumara/ -
Run:
testModel.ipynb
The model will predict the person’s identity.
| Component | Description |
|---|---|
| Learning Type | Supervised Learning |
| Dimensionality Reduction | PCA |
| Classifier | SVM |
| Output | Person Name |
| Model File | SVM-FaceRecognition.sav |
This project is intended only for academic and educational purposes. Avoid using it for unauthorized surveillance or privacy-sensitive applications.
Madhuka Malshan Software Engineering Student National Institute of Business Management (NIBM), Sri Lanka