Skip to content

Nossks/celeb_look_alike

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Celeb Look-Alike (End-to-End Deep Learning)

A Cyberpunk-themed AI web application that identifies your celebrity twin using Face Embeddings, Transfer Learning, and Vector Similarity Search.

Python TensorFlow Flask MediaPipe


๐Ÿ“ธ Project Demo

Cyberpunk UI Demo


๐Ÿš€ Key Features

  • 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.

๐Ÿ—๏ธ System Architecture

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;
Loading

๐Ÿ› ๏ธ Tech Stack

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

โš™๏ธ Installation & Setup

1๏ธโƒฃ Clone the Repository

git clone https://github.com/your-username/celeb-look-alike.git
cd celeb-look-alike

2๏ธโƒฃ Create Environment

conda create -n celeb python=3.11 -y
conda activate celeb

3๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

4๏ธโƒฃ Run the Application

python app.py

Access the app at http://127.0.0.1:5000 and enable webcam capture or upload an image.


๐Ÿง  Model Training Details

Phase 1: Warm-Up Training

  • Base Model: ResNet50 (ImageNet weights, frozen)
  • Outcome: ~40% accuracy (generic feature learning)

Phase 2: Fine-Tuning

  • Unfrozen top ResNet layers
  • Final Validation Accuracy: ~83.4%

๐Ÿ“‚ Project Structure

โ”œโ”€โ”€ 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

๐Ÿค Credits

  • Developer: Aryan Gairola
  • Dataset: kaggle link : "vishesh1412/celebrity-face-image-dataset"

About

It genrates the best match of input face to a celebrity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors