CoolFace
Apppublic

smpdshukla/deepfake-audio-detection-app

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

πŸŽ™ 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:

  1. 1.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.
  2. 2.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.
  3. 3.Model Prediction: Multiple deep learning models are used in parallel,CNN,RNN,BiLSTM,GRU,XGBoost for the prediction.
  4. 4.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.
  5. 5.Web App Integration: A user-friendly Streamlit interface allows non-technical users to upload audio files and instantly receive predictions.
  6. 6.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.

  1. 1.Advanced Ensemble Learning: Combines strengths of CNN, RNN, BiLSTM, GRU, and XGBoost to deliver high-accuracy predictions.
  2. 2.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.
  3. 3.Scalable and Extendable: The architecture is modular, allowing easy integration with new models, datasets, or cloud deployment platforms.

πŸ“¦ Dataset

  1. 1.Source: for-2seconds dataset taken from FoR dataset.(Publicly available speech datasets & synthetic deepfake audio.)
  1. 1.Temporary Testing Dataset:
  1. 1.Follow Path: temp/for-2seconds/testing/
  1. 1.Contains short 2-second audio clips for quick evaluation.
  1. 1.real/ β†’ Human voice samples.
  1. 1.fake/ β†’ AI-generated voice samples.
  1. 1.Supported Formats: .wav (default), .mp3 and .flac (when enabled in uploader).

πŸ“Š Models Used

ModelTypeRole in Stack
CNNDeep LearningBase model
RNNDeep LearningBase model
BiLSTMDeep LearningBase model
GRUDeep LearningBase model
XGBoostML AlgorithmBase model
Logistic RegressionML AlgorithmMeta-classifier

βœ… 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

  1. 1.Install dependencies:
bash
    pip install -r requirements.txt
  1. 1.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
  1. 1.Run the Streamlit app:
bash
    streamlit run app.py

4.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.