Skip to content

Latest commit

Β 

History

History
102 lines (67 loc) Β· 2.33 KB

File metadata and controls

102 lines (67 loc) Β· 2.33 KB
title emoji colorFrom colorTo sdk app_file pinned short_description license
FacialKeypointDetectionCNN
πŸ™‚
red
red
streamlit
src/streamlit_app.py
false
Predict facial keypoints from an uploaded face image
mit

πŸ™‚ Facial Keypoints Detection (CNN)

This app predicts facial keypoints (eyes, eyebrows, nose, mouth) from a face image.

πŸ”— Demo & Code

πŸ“Š Visual Results

Predicted Facial Keypoints (Validation Samples)
Model predictions across multiple faces β€” keypoints align well with facial structures.

Predicted Keypoints


Training Curves β€” Loss & RMSE
Stable convergence during CNN training with continuous error reduction.

Training Curves


Ground Truth vs Prediction
Predicted keypoints (red) closely match ground truth (green) across most landmarks.

GT vs Prediction


RMSE Distribution per Image
Most samples show low spatial error, indicating consistent localization quality.

RMSE Distribution

🎯 Task

Predict landmark coordinates for key facial regions:

  • eyes
  • eyebrows
  • nose
  • mouth

Input: face image
Output: 30 regression values (x/y for 15 keypoints)

The app overlays predicted keypoints directly on the processed image.

🧠 Model

  • Architecture: CNN (Keras)
  • Task type: multi-output regression
  • Output size: 30 coordinates
  • Loss: regression loss (MSE)
  • Input size: 96Γ—96 grayscale

πŸ–₯️ App Features

  • Image upload (RGB or grayscale)
  • Automatic preprocessing
  • CNN inference
  • Keypoint overlay visualization
  • Coordinate table output

Files in this repo

  • app.py β†’ Streamlit app
  • final_keypoints_cnn.keras β†’ trained Keras model
  • target_cols.json β†’ output column names (order of the 30 targets)
  • preprocess_config.json β†’ preprocessing settings (image size, normalization)

▢️ Run Locally

pip install -r requirements.txt
streamlit run src/streamlit_app.py

Resize to 96Γ—96

Normalize pixels: x / 255.0

Model predicts normalized coordinates

Convert back to pixel space: y = y * 48 + 48

Clip to valid range: [0, 96]