An advanced Python-based machine learning project designed to detect AI-generated speech (deepfakes). This is the highly optimized Version 2 of the system, upgrading the core architecture to utilize a Non-Linear Radial Basis Function (RBF) Support Vector Machine for state-of-the-art classification.
- Advanced Feature Extraction: Extracts 98 distinct features per audio file, including 13 MFCCs + Deltas, Spectral Centroid, Spectral Contrast, Spectral Rolloff, and Zero-Crossing Rate (ZCR).
- Audio Preprocessing: Automatically detects and trims silence from audio files before processing to ensure high-quality statistical mapping.
- Robust Classification: Uses a Non-Linear Support Vector Machine (RBF kernel) dynamically optimized with strict
GridSearchCVparameters for maximum generalization. - Explainable AI: Adapts visual explainability proxies for non-linear feature variances to provide insights and explain the model's predictions.
Ensure you have Python 3.8 or higher installed. You will also need pip for installing the required packages.
- Clone this repository to your local machine:
git clone https://github.com/DevAlnahari/Deepfake-Audio-Detector-V2.git cd Deepfake-Audio-Detector-V2 - Install the required dependencies:
pip install -r requirements.txt
Before running the model, ensure your dataset is properly organized into the following directory structure:
.
├── 📁 Train/
│ ├── 📁 Real/
│ └── 📁 Fake/
├── 📁 Val/
│ ├── 📁 Real/
│ └── 📁 Fake/
└── 📁 uploads/
Once your dataset is organized, run the main script to start extracting features and training the model:
python main.pyThe model has been evaluated on a comprehensive validation dataset with the following results:
- Model Architecture: Non-Linear SVM (
kernel='rbf',class_weight='balanced') - Validation Dataset Size: 1,846 audio files
- Accuracy: 99.13%
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
This project is open-source and available under the MIT License.