In the age of deepfakes, seeing is no longer believing.
But even if you can't trust your eyes, you can trust us.
DeepDetect is an AI-powered application that helps you uncover the truth behind manipulated media.
Deployment Note:
The public Hugging Face Space uses a Gradio interface for interactive demos and explainability.
A FastAPI backend is also included in this repository for production-style API usage and integration.
Note: Due to limited computational resources, the current model has been trained on a relatively small dataset using a short
sequence_lengthof 10.
This means it utilizes only 10 frames from any uploaded video to make a prediction.
- Accuracy: ~93%
- F1 Score: ~93%
- 🔍 Deepfake detection using AI
- 🖼️ Visual explanation via heatmaps
- 🎛️ Gradio-powered user interface
- ⚡ FastAPI backend for scalable inference (not used in Hugging Face Space)
- ⚙️ End-to-end ML pipeline with MLflow & DVC integration
- Data Processing: NumPy, Pandas
- Modeling: PyTorch, Scikit-learn
- Image & Video: OpenCV, MediaPipe
- Visualization: Plotly
- MLOps: MLflow, DVC
- UI: Gradio
- Deployment: Hugging Face Spaces
DeepDetect/
│
├── src/
│ └── DeepfakeDetection/
│ ├── components/ # Core components: data loading, preprocessing, training
│ ├── utils/ # Utility scripts and helpers
│ ├── config/ # Configuration files
│ ├── pipeline/ # Modular pipeline stages
│ ├── entity/ # Configuration entity classes
│ └── constants/ # Constants and global values
│
├── config/ # Global configs
├── app.py # Gradio app entry point
├── main.py # Pipeline runner
├── requirements.txt # Python dependencies
├── pyproject.toml # Project metadata
├── params.yaml # Model & training parameters
├── dvc.yaml # DVC pipeline configuration
├── Dockerfile # Docker setup
├── structure.py # Script to auto-generate project structure
└── format.sh # Shell script for formatting code
- Clone the repository:
git clone https://github.com/your-username/DeepDetect.git cd DeepDetect - Make sure Python ≥ 3.9 is installed.
- Update
requirements.txtto.eif needed, then run:pip install -r requirements.txt
- Install CMake
On Ubuntu:sudo apt install cmake
- (Optional) Install Docker for containerized deployment.
- Download the FaceForensics++ dataset (see below).
Update thesource_datapath inconfig/config.yamlto point to your local data directory.
This project uses the FaceForensics++ dataset.
To obtain it:
-
Visit the official repository: https://github.com/ondyari/FaceForensics
-
Fill out the dataset request form
-
After approval, you will receive:
- Download credentials
- An official download script
-
Use the provided script to download the data locally
-
Update the dataset path in:
config/config.yaml
dvc init --force
dvc reproOr manually:
python main.py# Step 1: Data Ingestion
python src/DeepfakeDetection/pipeline/stage_01_data_ingestion.py
# Step 2: Preprocessing
python src/DeepfakeDetection/pipeline/stage_02_data_preprocessing.py
# Step 3: Model Training
python src/DeepfakeDetection/pipeline/stage_03_model_training.py
# Step 4: Evaluation
python src/DeepfakeDetection/pipeline/stage_04_model_evaluation.pypython app.pyuvicorn api:app --host 0.0.0.0 --port 8000🔐 Note:
By default, the prediction pipeline loads the model from MLflow (logged during training). Ensure MLflow initialization is enabled in:
stage_03_model_training.pystage_04_model_evaluation.py
Set up your
.envfile with MLflow credentials at the project root, and make sure you’ve executeddvc repro.MLFLOW_TRACKING_URI=your_mlflow_tracking_uri MLFLOW_TRACKING_PASSWORD=your_mlflow_passUpdate
prediction.pyto load your generated MLflow run, for example:mlflow.pytorch.load_model("runs:/<your_run_id>/model")Alternatively, if you don’t want to use MLflow, modify the loading logic in
prediction.pyto use the trained model (after running the complete pipeline) located at:/artifacts/model_training
We’d love your contributions!
- Fork the repo
- Create a new branch:
git checkout -b feature/amazing-feature
- Make your changes & commit:
git commit -am "Add amazing feature" - Push your branch:
git push origin feature/amazing-feature
- Open a Pull Request
This project is licensed under the GPL-3.0 License.
Made with ❤️ by Sanskar Modi
