- Project Overview
- Features
- Project Structure
- System Requirements
- Installation Guide
- Usage
- Cloning Instructions
- Model Information
- Technical Details
- Troubleshooting
- Contributing
This project is an advanced Deepfake Detection System that uses deep learning models to identify manipulated (fake) images and videos. The system employs EfficientNetV2 architecture for visual content analysis, providing real-time detection with confidence scores.
Deepfakes are synthetic media created using artificial intelligence to manipulate or generate visual and audio content. This tool helps identify such manipulated content.
- ๐ Media Verification - Verify authenticity of images and videos
- ๐ฐ Journalism - Fact-checking visual content
- ๐ก๏ธ Security - Detect manipulated surveillance footage
- ๐ Education - Learn about AI detection techniques
- ๐ Research - Academic deepfake detection research
- ๐ผ๏ธ Image Detection - Analyze single images for deepfake manipulation
- ๐ฌ Video Detection - Frame-by-frame analysis of video content
- ๐ Confidence Scoring - Get percentage-based confidence levels
- ๐จ Modern UI - Large, user-friendly Gradio interface
- โก Real-time Processing - Fast detection results
- ๐ Example Files - Pre-loaded test images and videos
- ๐ Batch Processing - Analyze multiple frames in videos
newmultimodal/
โ
โโโ ๐ app.py # Main Gradio application interface
โโโ ๐ pipeline.py # Core detection pipeline and logic
โโโ ๐ rawnet.py # RawNet2 model architecture (audio)
โโโ ๐ requirements.txt # Python dependencies
โโโ ๐ packages.txt # System-level dependencies
โโโ ๐ run_app.bat # Windows batch script to run app
โโโ ๐ .gitignore # Git ignore configuration
โโโ ๐ .gitattributes # Git LFS configuration
โ
โโโ ๐ efficientnet-b0/ # EfficientNet B0 model directory
โ โโโ saved_model.pb # TensorFlow saved model
โ โโโ keras_metadata.pb # Keras model metadata
โ โโโ variables/ # Model weights and variables
โ
โโโ ๐ images/ # Example images for testing
โ โโโ images_lady.jpg # Example real image
โ โโโ images_fake_image.jpg # Example fake image
โ
โโโ ๐ videos/ # Example videos for testing
โ โโโ celeb_synthesis.mp4 # Example fake video
โ โโโ real-1.mp4 # Example real video
โ
โโโ ๐ audios/ # Example audio files (optional)
โ โโโ *.flac # Audio samples
โ
โโโ ๐ฆ RawNet2.pth # RawNet2 audio model weights (67 MB)
โ
โโโ ๐ .git/ # Git repository (if cloned)
| File/Folder | Purpose | Size | Required |
|---|---|---|---|
app.py |
Main application with Gradio UI | ~2 KB | โ Yes |
pipeline.py |
Detection logic & preprocessing | ~7 KB | โ Yes |
rawnet.py |
Audio detection model class | ~14 KB | |
requirements.txt |
Python package dependencies | ~135 B | โ Yes |
efficientnet-b0/ |
Image/Video detection model | ~87 MB | โ Yes |
RawNet2.pth |
Audio detection weights | ~67 MB | |
images/ |
Example test images | ~36 KB | ๐ Recommended |
videos/ |
Example test videos | ~840 KB | ๐ Recommended |
Python 3.10.11 (Tested and Verified โ )
Why Python 3.10.11?
- Best compatibility with TensorFlow 2.12
- Stable support for all dependencies
- Optimal performance with PyTorch
- Well-tested in production environments
- โ Python 3.10.x (Any 3.10 version)
- โ Python 3.9.x (Compatible but not optimal)
โ ๏ธ Python 3.11+ (May have dependency conflicts)- โ Python 3.8 or lower (Not supported)
- RAM: Minimum 8 GB, Recommended 16 GB
- Storage: ~500 MB for models and dependencies
- GPU: Optional (CPU inference works fine)
- OS: Windows 10/11, Linux, macOS
Download from: https://www.anaconda.com/download
# Create environment with Python 3.10.11
conda create -n deepfake_detector python=3.10.11 -y
# Activate the environment
conda activate deepfake_detector# Navigate to project directory
cd path/to/newmultimodal
# Install all requirements
pip install -r requirements.txt# Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y ffmpeg libsm6 libxext6
# For other Linux distributions, install equivalent packages# Check Python version
python --version
# Should output: Python 3.10.11# Navigate to project directory
cd path/to/newmultimodal
# Create virtual environment
python -m venv deepfake_env
# Activate environment
# Windows:
deepfake_env\Scripts\activate
# Linux/Mac:
source deepfake_env/bin/activate# Upgrade pip
python -m pip install --upgrade pip
# Install requirements
pip install -r requirements.txt# Install directly to system Python
pip install -r requirements.txttensorflow==2.12.0 # Deep learning framework
gradio # Web interface
opencv-python # Image/video processing
opencv-python-headless # Headless OpenCV
numpy # Numerical operations
torch # PyTorch for audio model
torchvision # Vision utilities
facenet_pytorch # Face detection
mtcnn # Multi-task CNN
moviepy # Video processing
librosa # Audio processing
All dependencies are automatically installed via requirements.txt.
# Double-click or run:
run_app.bat# Activate environment first
conda activate deepfake_detector # or your env name
# Run the application
python app.py# Run without activating (from any directory)
conda run -n deepfake_detector python app.pyOnce running, the application will display:
Running on local URL: http://127.0.0.1:7860
Open this URL in your web browser to access the interface.
-
Image Detection:
- Navigate to "Image inference" tab
- Click upload area or drag & drop an image
- Click "Submit" button
- View detection result with confidence score
-
Video Detection:
- Navigate to "Video inference" tab
- Upload a video file
- Click "Submit" button
- Wait for frame-by-frame analysis
- View aggregated detection result
-
Example Files:
- Click on example images/videos below upload area
- Automatically runs detection
# Clone the repository
git clone https://github.com/Jo9gi/DeepFake_Detector.git
# Navigate into directory
cd DeepFake_Detector
# Install dependencies
pip install -r requirements.txt
# Run the application
python app.py# Install Git LFS first (one-time setup)
git lfs install
# Clone with large files
git clone https://github.com/Jo9gi/DeepFake_Detector.git
# If models are missing, pull them:
cd DeepFake_Detector
git lfs pull# Skip large files during clone (faster)
GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/Jo9gi/DeepFake_Detector.git
# Download models later when needed
cd DeepFake_Detector
git lfs pull --include="efficientnet-b0/*"- Architecture: EfficientNetV2
- Variant: B0 (Smallest, fastest)
- Input Size: 224x224 pixels
- Output: Binary classification (Real/Fake)
- Size: ~87 MB
- Framework: TensorFlow/Keras
- Architecture: RawNet2
- Purpose: Audio deepfake detection
- Input: Raw audio waveforms
- Output: Binary classification
- Size: ~67 MB
- Framework: PyTorch
-
Input Processing:
- Images: Resized to 224x224 RGB
- Videos: Extracted frames at intervals
- Normalization: Pixel values scaled to [0, 1]
-
Feature Extraction:
- EfficientNet convolutional layers
- Compound scaling for efficiency
- MBConv blocks with squeeze-excitation
-
Classification:
- Binary output (Real vs Fake)
- Softmax activation
- Confidence scores in percentage
-
Video Aggregation:
- Frame-by-frame analysis
- Mean confidence across frames
- Threshold: 50% for classification
- Inference Time:
- Image: ~0.5-2 seconds
- Video: ~2-10 seconds (depends on length)
- Accuracy: Varies by content type
- Supported Formats:
- Images: JPG, PNG, JPEG, WEBP
- Videos: MP4, AVI, MOV, MKV
Error: module 'tensorflow' has no attribute 'random'
Solution:
pip uninstall tensorflow tensorflow-intel -y
pip install tensorflow==2.12.0Error: Could not load dynamic library 'cudart64_110.dll'
Solution: Install CPU version or ignore (CPU inference works)
pip install tensorflow-cpu==2.12.0Error: Address already in use: 7860
Solution: Kill existing process or change port
# In app.py, change:
app.launch(share=False, server_port=7861)Error: ResourceExhaustedError: OOM when allocating tensor
Solution: Process smaller images or videos, or increase system RAM
Error: No such file or directory: 'efficientnet-b0/'
Solution: Ensure Git LFS pulled the models
git lfs pull- Check existing GitHub Issues
- Review Hugging Face Space discussions
- Ensure all dependencies are installed correctly
Contributions are welcome! Here's how you can help:
- Fork the Repository
- Create a Feature Branch
git checkout -b feature/your-feature-name
- Make Your Changes
- Test Thoroughly
- Commit Your Changes
git commit -m "Add: your feature description" - Push to Branch
git push origin feature/your-feature-name
- Open a Pull Request
- ๐จ UI/UX improvements
- ๐งช Additional model architectures
- ๐ Performance optimizations
- ๐ Documentation enhancements
- ๐ Bug fixes
- ๐ Multi-language support
This project is available for educational and research purposes. Please use responsibly and cite appropriately when using in academic work.
- EfficientNet Architecture: Google Research
- Gradio Framework: Gradio Team for the web interface
- TensorFlow: Google Brain Team
- Deep Learning Community: For open-source tools and models
- GitHub Repository: https://github.com/Jo9gi/DeepFake_Detector
- Issues: Use GitHub Issues tab for bug reports
- Discussions: GitHub Discussions for questions and ideas
- v1.0.0 - Initial release with image and video detection
- v1.1.0 - Enhanced UI with larger interface
- v1.2.0 - Removed audio tab, cleaned project structure
This tool is for educational and research purposes. While it aims to detect deepfakes accurately, no detection system is perfect. Always verify important content through multiple sources.
Made with โค๏ธ for a safer digital world