Real vs Fake Face Detector 🔍🤖
A machine learning-powered web app that detects whether a face image is Real or Fake (AI-generated). Built using a deep learning model served via a smooth Node.js + Express backend and styled with a simple frontend interface. This project is open to improvements and community contributions! 💫
🧠 How It Works
- User uploads a face image through the browser.
- The image is sent to the backend via AJAX (without page reload).
- Node.js server passes the image buffer to a Python script.
- A TensorFlow/Keras model processes the image and predicts Real or Fake.
- The prediction is returned as JSON and displayed live on the page.
🗃️ Dataset Used
This model was trained using the 140K Real and Fake Faces dataset from Kaggle.
📦 Dataset: https://www.kaggle.com/datasets/xhlulu/140k-real-and-fake-faces
⚠️ Note: This model performs best on images similar to the dataset (clean, centered, portrait-style images). Unseen fake styles or out-of-distribution faces may result in inaccurate predictions.
📦 Tech Stack
Layer | Technology |
---|---|
Frontend | HTML, CSS, JavaScript (jQuery) |
Backend | Node.js, Express |
Machine Learning | TensorFlow, Keras, Python |
Image Upload | Multer (memory storage) |
🚀 Getting Started
- Clone the Repository
git clone https://github.com/yourusername/RealVsFakeFaceDetector.git cd RealVsFakeFaceDetector
- Install Node.js Dependencies
npm install
- Set Up Python Environment
Make sure Python is installed (>= 3.10), and install required packages:pip install tensorflow numpy opencv-python
- Start the Server
node server.js
- Visit the App in Your Browser
http://localhost:4000
-
Repository link
https://github.com/emaaanbutt/ReaVsFakeFaceDetector
🎯 Prediction UI
Users can upload an image and get results displayed live under the form — without any page reloads!
Example output:
Prediction: Real (99.34%)
Prediction: Fake (78.23%)
⚠️ Limitations
- 🚫 May misclassify GAN types not seen during training.
- 🧠 Trained on 140K images, mostly focused on a specific GAN type.
- 🖼️ Performance drops on heavily edited, noisy, or side-view face images.
✨ Future Improvements
- Add image preprocessing for better generalization.
- Enhance model with more GAN variety (StyleGAN2, etc.).
- Improve frontend with drag-and-drop uploads.
❤️ Acknowledgements
- Dataset: 140K Real and Fake Faces on Kaggle
- TensorFlow / Keras
- Node.js & Express
- jQuery for seamless AJAX form handling
📜 License
This project is licensed under the MIT License — free for personal or academic use. Please give credit if you use it or build upon it 💖