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