PixelTruth is an AI-powered deepfake detection system for social media images. It uses a custom Convolutional Neural Network (CNN) with advanced preprocessing to classify images as real or AI-generated with 95% accuracy.
- About
- Features
- Tech Stack
- Performance
- Installation
- Usage
- Project Structure
- Contributing
- GSSoC 2026
- License
With the rise of AI-generated media, detecting deepfakes has become critical for media integrity and combating misinformation. PixelTruth addresses this by providing a fast, accurate, and accessible deepfake detection tool built on deep learning.
It analyzes visual artifacts introduced during image synthesis and classifies images in real-time through an intuitive web dashboard.
- 🖼️ Real-time image analysis — supports JPG, PNG, WebP formats
- 📊 Confidence scores — shows probability of real vs. fake
- 🎨 Modern Streamlit dashboard — glassmorphism UI with visual feedback
- ⚡ Fast inference — lightweight model optimized for speed
- 🔬 Custom preprocessing pipeline — enhanced artifact detection
| Tool | Purpose |
|---|---|
| Python | Core language |
| TensorFlow / Keras | CNN model training & inference |
| OpenCV | Image preprocessing |
| Streamlit | Web dashboard |
| NumPy / Matplotlib | Data handling & visualization |
| Metric | Value |
|---|---|
| Accuracy | 95% |
| Input Size | 96 x 96 px |
| Supported Formats | JPG, PNG, WebP |
⚠️ Prerequisites:
- Python Version: This project strictly requires Python 3.11. (Newer versions like Python 3.12 are currently incompatible with the required TensorFlow dependencies).
- Windows Users:
- You must have the Microsoft Visual C++ Redistributable installed to run TensorFlow.
- If the app crashes on launch with a DLL error, install
tensorflow-cpuinstead of standardtensorflow.
# 1. Clone the repository
git clone https://github.com/Piyush-Sharma788/PixelTruth.git
cd PixelTruth
# 2. Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txtPixelTruth also needs a trained model file before it can make predictions.
Set a direct download URL for the trained model (for example, a GitHub Release asset) and the app will fetch it automatically when it starts:
export PIXELTRUTH_MODEL_URL=https://your-release-link/deepfake_detection_model.h5
export PIXELTRUTH_MODEL_SHA256=<optional-sha256>
streamlit run app.pyDownload the model with the helper script:
python scripts/download_model.py --url https://your-release-link/deepfake_detection_model.h5 --dest deepfake_detection_model.h5- Download or generate the trained Keras model.
- Save it as
deepfake_detection_model.h5in the project root, or setPIXELTRUTH_MODEL_PATHto the file location. - Restart the app after placing the model file.
If you keep the model in a different folder, export the path before launching Streamlit:
export PIXELTRUTH_MODEL_PATH=/full/path/to/deepfake_detection_model.h5
streamlit run app.pyIf you receive the model from a release asset or shared download link, copy it into the project root first:
cp /path/to/downloaded/deepfake_detection_model.h5 ./deepfake_detection_model.h5If you publish the model as a GitHub Release asset, the recommended setup is:
- Upload
deepfake_detection_model.h5to the release. - Copy the release asset URL into
PIXELTRUTH_MODEL_URL. - Optionally record the SHA256 checksum in
PIXELTRUTH_MODEL_SHA256. - Start the app with
streamlit run app.py.
# Run the Streamlit dashboard
streamlit run app.pyThen open your browser at http://localhost:8501, upload an image, and get instant results.
PixelTruth/
├── app.py # Streamlit dashboard
├── predict.py # Inference logic
├── train.py # Model training (v1)
├── train_v2.py # Model training (v2)
├── train_v3.py # Model training (v3)
├── requirements.txt # Dependencies
├── Figure_1.png # Training result plot
├── Figure_2.png # Evaluation plot
└── README.md
We welcome contributions of all kinds! Whether you're fixing a bug, improving the UI, or adding new features — you're welcome here.
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add your feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
Please read CONTRIBUTING.md for detailed guidelines.
PixelTruth is participating in GirlScript Summer of Code 2026!
We have beginner-friendly issues ready. Look for issues labelled:
good-first-issuebeginner-friendlydocumentationenhancement
Feel free to explore open issues and start contributing!
This project is licensed under the MIT License — see the LICENSE file for details.
Built with ❤️ for media integrity by Piyush Sharma
If you found this useful, please ⭐ star the repo!