smpdshukla/deepfake-audio-detection-app
0
π Deep-fake-Audio-Detection
Deep fake Audio Detection is AI/ML based project that uses classification models to detect whether audio is real or a machine generated. The pipeline includes:
- Audio Preprocessing: Converts raw audio into machine-readable features. It extracts Mel-Frequency Cepstral Coefficients (MFCCs), which help the model capture nuances in human speech.
- Feature Normalization: Applies a pre-trained scaler to normalize features across different audio samples, ensuring consistency and reducing model bias caused by amplitude variations or background noise.
- Model Prediction: Multiple deep learning models are used in parallel,CNN,RNN,BiLSTM,GRU,XGBoost for the prediction.
- Ensemble Learning: Outputs from all base models are combined using a Logistic Regression meta-classifier, which assigns optimal weights,and XGBoost, which captures complex non-linear relationships.
- Web App Integration: A user-friendly Streamlit interface allows non-technical users to upload audio files and instantly receive predictions.
- Performance: Deep learning models like CNN and BiLSTM excel individually (95% and 92% accuracy respectively), but combining them through stacking significantly improves robustness. Our final ensemble model achieved ~94% overall accuracy, outperforming individual models while remaining efficient enough for real-world deployment.
π Features
1.Deepfake vs. Real Detection: Identifies whether an uploaded audio clip is genuine human speech or synthetically generated using deepfake technology.
- Advanced Ensemble Learning: Combines strengths of CNN, RNN, BiLSTM, GRU, and XGBoost to deliver high-accuracy predictions.
- Cross-Platform Deployment: Works seamlessly as a Streamlit interface, depending on the use case. 4.User-Friendly Interface: Non-technical users can easily upload audio files without requiring command-line interaction.
- Scalable and Extendable: The architecture is modular, allowing easy integration with new models, datasets, or cloud deployment platforms.
π¦ Dataset
- Source: for-2seconds dataset taken from FoR dataset.(Publicly available speech datasets & synthetic deepfake audio.)
- Temporary Testing Dataset:
- Follow Path: temp/for-2seconds/testing/
- Contains short 2-second audio clips for quick evaluation.
- real/ β Human voice samples.
- fake/ β AI-generated voice samples.
- Supported Formats: .wav (default), .mp3 and .flac (when enabled in uploader).
π Models Used
β Meta-classifier combines all base modelsβ predictions for final classification.
π Tech Stack & Tools
- Languages: Python 3.9+
- Deep Learning: TensorFlow, Keras
- Machine Learning: XGBoost, Scikit-learn, Logistic Regression (meta-classifier)
- Audio Processing: Librosa, SoundFile
- Data Handling: NumPy, Pandas
- Visualization: Matplotlib, Seaborn
- UI & Deployment: Streamlit
- Environment: Jupyter Notebook, Anaconda
βΆοΈ Usage
- Install dependencies:
pip install -r requirements.txt- Download the dataset consisting of Fake and Real audio files for testing: π Fake-or-Real (FoR) Dataset on Kaggle or from the temp folder from the github repo
- Run the Streamlit app:
streamlit run app.py4.Upload an audio file via the interface.
5.View prediction β whether the audio is Real or Deepfake.
π Visual Outputs in App
- π΅ Waveform of uploaded audio
- πΌ MFCC feature plot
- π Stacked model performance chart
- π Final result in a highlight box β "Real" or "Fake" with confidence %
π Future Improvements
1.Support for multilingual audio.
2.Real-time streaming detection.
3.Cloud deployment for scalability.
4.Integration of Explainable AI (XAI) for transparency.
