Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- image-classification
|
| 4 |
+
- face-recognition
|
| 5 |
+
- keras
|
| 6 |
+
- tensorflow
|
| 7 |
+
- opencv
|
| 8 |
+
library_name: keras
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Face Recognition Model
|
| 12 |
+
|
| 13 |
+
A CNN-based face recognition model built from scratch using Keras/TensorFlow.
|
| 14 |
+
|
| 15 |
+
## People it recognizes
|
| 16 |
+
- Aafreen
|
| 17 |
+
- Syeda
|
| 18 |
+
- Taha
|
| 19 |
+
|
| 20 |
+
## Model Architecture
|
| 21 |
+
- 4 Convolutional Blocks (Conv2D → BatchNorm → ReLU → MaxPool)
|
| 22 |
+
- Filters: 32 → 64 → 128 → 256
|
| 23 |
+
- Dense(256) → Dropout(0.5) → Dense(3, Softmax)
|
| 24 |
+
- Input size: 128×128×3
|
| 25 |
+
|
| 26 |
+
## Training Details
|
| 27 |
+
- Dataset: ~71 images (22–26 per person)
|
| 28 |
+
- Augmentation: 7 variants per training image (flip, rotation, brightness, zoom)
|
| 29 |
+
- Split: 70% train / 15% val / 15% test
|
| 30 |
+
- Optimizer: Adam (lr=0.001)
|
| 31 |
+
- Loss: Categorical Crossentropy
|
| 32 |
+
- Callbacks: EarlyStopping, ReduceLROnPlateau, ModelCheckpoint
|
| 33 |
+
|
| 34 |
+
## Files
|
| 35 |
+
| File | Description |
|
| 36 |
+
|------|-------------|
|
| 37 |
+
| `face_model.h5` | Trained Keras model |
|
| 38 |
+
| `class_names.json` | Label index mapping |
|
| 39 |
+
| `training_curves.png` | Accuracy & loss plots |
|
| 40 |
+
| `confusion_matrix.png` | Evaluation results |
|
| 41 |
+
|
| 42 |
+
## How to use
|
| 43 |
+
```python
|
| 44 |
+
from tensorflow.keras.models import load_model
|
| 45 |
+
import json, numpy as np
|
| 46 |
+
|
| 47 |
+
model = load_model('face_model.h5')
|
| 48 |
+
with open('class_names.json') as f:
|
| 49 |
+
class_names = json.load(f)
|
| 50 |
+
|
| 51 |
+
# Predict on a 128x128 face crop
|
| 52 |
+
img = img / 255.0
|
| 53 |
+
img = np.expand_dims(img, axis=0)
|
| 54 |
+
pred = model.predict(img)
|
| 55 |
+
label = class_names[str(np.argmax(pred))]
|
| 56 |
+
conf = np.max(pred)
|
| 57 |
+
print(f"{label} ({conf*100:.1f}%)")
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Project
|
| 61 |
+
Applied AI Final Project — COMP 6721
|
| 62 |
+
Concordia University, Winter 2026
|