https://github.com/ebrahimgolriz/face-recognition-with-cnn
Developed a convolutional neural network (CNN) utilizing FaceNet to detect and identify multiple faces in an image with high accuracy.
https://github.com/ebrahimgolriz/face-recognition-with-cnn
cnn deep-learning face-recognition facenet keras support-vector-machines vgg16
Last synced: 5 months ago
JSON representation
Developed a convolutional neural network (CNN) utilizing FaceNet to detect and identify multiple faces in an image with high accuracy.
- Host: GitHub
- URL: https://github.com/ebrahimgolriz/face-recognition-with-cnn
- Owner: EbrahimGolriz
- Created: 2025-02-08T22:51:43.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-02-08T23:18:21.000Z (5 months ago)
- Last Synced: 2025-02-09T00:20:10.101Z (5 months ago)
- Topics: cnn, deep-learning, face-recognition, facenet, keras, support-vector-machines, vgg16
- Language: Python
- Homepage:
- Size: 6.84 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Face Recognition using CNN and FaceNet


A deep learning-based CBIR system for face recognition using **CNNs**, **VGG16**, and **FaceNet**, optimized for celebrity face retrieval and classification.
**Full, Detailed report and walkthrough is available in Report.pdf**
## 📁 Dataset
**Source:** [Celebrity Face Dataset (Kaggle)](https://www.kaggle.com/datasets/vasukipatel/face-recognition-dataset)
**Structure:**
- 31 celebrity folders (e.g., `Henry Cavill`, `Natalie Portman`)
- 50–150 images per class (varied poses/lighting)
- Cropped faces using MTCNN for focus## 🛠️ Methodology
### 1. **Custom CNN**
- **Architecture:**
`Conv2D → MaxPooling → BatchNorm → Dropout → Dense`
- **Training:**
- 3 classes (Henry Cavill, Natalie Portman, Robert Downey Jr.)
- 30 epochs, Adam optimizer
- **Accuracy:** 81.48% (test set)### 2. **VGG16 Transfer Learning**
- **Preprocessing:** Data augmentation (rotation, flip, brightness)
- **Fine-tuning:**
- Frozen base layers + custom dense layers
- **Accuracy:** 92.59% (test set)
- **Limitation:** Overconfidence in misclassifications### 3. **FaceNet + SVM**
- **Embeddings:** 128D face features extracted via FaceNet
- **Classifier:** SVM with linear kernel
- **Accuracy:** **99.63%** (test set)
- **Key Advantage:** Robust to pose/lighting variations## 📊 Key Results
| Model | Test Accuracy | F1-Score | Specialization |
|----------------|---------------|----------|-------------------------|
| Custom CNN | 81.48% | 0.81 | Basic face recognition |
| VGG16 | 92.59% | 0.93 | Transfer learning |
| **FaceNet+SVM**| **99.63%** | **0.99** | State-of-the-art performance |## 💻 How to Run
1. Install dependencies:
```bash
pip install tensorflow keras-facenet scikit-learn mtcnn opencv-python matplotlib