Views
No views yet
| 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 |
1from tensorflow.keras.models import load_model
2import json, numpy as np
3
4model = load_model('face_model.h5')
5with open('class_names.json') as f:
6 class_names = json.load(f)
7
8# Predict on a 128x128 face crop
9img = img / 255.0
10img = np.expand_dims(img, axis=0)
11pred = model.predict(img)
12label = class_names[str(np.argmax(pred))]
13conf = np.max(pred)
14print(f"{label} ({conf*100:.1f}%)")