A Cyberpunk-themed AI web application that identifies your celebrity twin using Face Embeddings, Transfer Learning, and Vector Similarity Search.
- End-to-End Pipeline: Covers the complete lifecycle from raw image ingestion to production inference.
- Cyberpunk UI: Neon-styled frontend with real-time Webcam Integration using HTML5 + JavaScript.
- Robust Face Extraction: Automatic face detection, alignment, and cropping using MediaPipe.
- Deep Learning Core: Fine-tuned ResNet50 achieving ~83.4% validation accuracy on a custom dataset.
- Vector Similarity Search: One-shot learning using 128-D L2-normalized embeddings and Cosine Similarity.
The system follows a modular ComponentโPipeline Architecture.
graph TD
classDef user fill:#ff9,stroke:#333,stroke-width:2px,color:black;
classDef frontend fill:#00f7ff,stroke:#000,stroke-width:2px,color:black;
classDef backend fill:#39ff14,stroke:#000,stroke-width:2px,color:black;
classDef ai fill:#ff00ff,stroke:#000,stroke-width:2px,color:white;
classDef data fill:#ffa500,stroke:#000,stroke-width:2px,color:black;
User(["๐ค User"]) --> UI["๐ป Web Interface<br/>(HTML / JS / Cyberpunk CSS)"]
UI --> Flask["๐ฅ Flask Server<br/>(app.py)"]
subgraph Inference ["โก Inference Pipeline"]
Flask --> MP["๐ท Face Extractor<br/>(MediaPipe)"]
MP --> RN["๐ง Embedding Model<br/>(ResNet50)"]
RN --> Vec["128-D Vector<br/>L2 Normalized"]
end
subgraph Search ["๐ Similarity Search"]
Vec --> Match["๐งฎ Cosine Similarity"]
DB[("๐๏ธ Stored Embeddings<br/>Pickle")] --> Match
end
Match --> Output["โ
Match Result"]
Output --> Flask
subgraph Training ["๐๏ธ Offline Training"]
Raw["๐ Dataset"] --> Aug["๐ Augmentation"]
Aug --> Trainer["๐๏ธ Trainer"]
Trainer --> RN
Trainer --> DB
end
class User user;
class UI frontend;
class Flask,MP,Match,Output backend;
class RN,Vec,Trainer,Aug ai;
class DB,Raw data;
| Domain | Tools |
|---|---|
| Language | Python 3.11 |
| Deep Learning | TensorFlow 2.15, Keras (Transfer Learning) |
| Computer Vision | MediaPipe 0.10.9, OpenCV, Pillow |
| Backend | Flask 3.1.2, Gunicorn |
| Frontend | HTML5, CSS3 (Neon Theme), JavaScript (Webcam API) |
| Data | NumPy, Pickle, Scikit-learn |
git clone https://github.com/your-username/celeb-look-alike.git
cd celeb-look-alikeconda create -n celeb python=3.11 -y
conda activate celebpip install -r requirements.txtpython app.pyAccess the app at http://127.0.0.1:5000 and enable webcam capture or upload an image.
- Base Model: ResNet50 (ImageNet weights, frozen)
- Outcome: ~40% accuracy (generic feature learning)
- Unfrozen top ResNet layers
- Final Validation Accuracy: ~83.4%
โโโ data # Cropped faces dataset used during embedding genration
โโโ artifacts/ # Models (.h5) and embeddings.pkl
โโโ notebooks/ # Experiments & EDA
โโโ src/
โ โโโ components/ # Data ingestion, trainer, generators
โ โโโ pipelines/ # Training & prediction pipelines
โ โโโ exception.py # Custom exceptions
โ โโโ logger.py # Logging
โ โโโ utils.py # Face extraction & helpers
โโโ static/
โ โโโ css/ # Cyberpunk styling
โ โโโ js/ # Webcam logic
| โโโ uploads/ # Temporary hold the image
โโโ templates/ # HTML templates
โโโ app.py # Flask entry point
โโโ requirements.txt # Dependencies
- Developer: Aryan Gairola
- Dataset: kaggle link : "vishesh1412/celebrity-face-image-dataset"
