This application uses MesoNet and FastAPI to detect deepfakes in uploaded videos, images, or live webcam streams.
- Upload videos for deepfake analysis
- Upload images for instant deepfake detection
- Live webcam deepfake detection
- Per-frame confidence scores
- Visual timeline of detection results
- Face detection and highlighting
- Python 3.8 or higher
- macOS users with Apple Silicon (M1/M2/M3) require special TensorFlow installation
-
Clone this repository
git clone <repository-url> cd deepfakerealtimedetection
-
Create and activate a virtual environment (recommended)
python3 -m venv venv source venv/bin/activate -
Install the required packages
# For Intel-based systems pip install -r requirements.txt # For Apple Silicon (M1/M2/M3) Macs # Note: You might need to install packages individually if you encounter issues pip install fastapi uvicorn pip install numpy opencv-python mediapipe python-multipart pillow jinja2 aiofiles pip install tensorflow-macos tensorflow-metal
Start the server:
python3 run.pyThen open your browser and go to http://localhost:8000
- Upload a video file, image file, or use your webcam for real-time detection
- View the analysis results showing confidence scores for deepfake probability
- For videos, examine the frame-by-frame timeline for detailed analysis
- For images, see highlighted faces with individual confidence scores
- FastAPI for the backend API
- MesoNet model for deepfake detection
- MediaPipe for face detection
- ONNX Runtime for optimized inference (when available)
- JavaScript/HTML for the frontend interface
- If you encounter "Module not found" errors, ensure all dependencies are installed
- For Apple Silicon Macs, use the TensorFlow Metal version for GPU acceleration
- If port 8000 is unavailable, modify the port in run.py