Skip to content

cemgolo/DeepGuard-voice

Repository files navigation

DeepGuard Voice Authentication System

DeepGuard is a voice authentication system that uses deep learning to verify speaker identity and detect deepfake audio. It now includes voice password functionality for dual-factor verification.

Features

  • Speaker Verification: Identify unique voice characteristics using ECAPA-TDNN models
  • Deepfake Detection: Detect synthetic/manipulated voice (optional)
  • Voice Password: Dual authentication with both voice biometrics and spoken password verification
  • Command-line Interface: Simple commands for enrollment and authentication
  • Offline Operation: All processing happens locally - no cloud dependencies

Requirements

  • Python 3.7+
  • PyTorch
  • SpeechBrain
  • HuggingFace Transformers
  • Sounddevice or PyAudio (for microphone recording)
  • See requirements.txt for full dependencies

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/deepguard-voice.git
cd deepguard-voice
  1. Install dependencies:
pip install -r requirements.txt

Quick Start

Enrolling a New User

Enroll a user using microphone input:

python src/main.py enroll --user_id john

This will:

  1. Open your microphone and prompt you to speak your voice password
  2. Record your voice for about 5 seconds
  3. Extract speaker embeddings for voice biometrics
  4. Transcribe your spoken sentence as your voice password
  5. Store both for future authentication

Or enroll using an existing audio file:

python src/main.py enroll --user_id john --audio path/to/audio.wav

Authenticating a User

Authenticate using microphone input:

python src/main.py authenticate --user_id john

This will:

  1. Open your microphone and prompt you to speak your voice password
  2. Verify BOTH your voice biometrics AND your spoken password match
  3. Only succeed if both factors pass verification

Or authenticate using an audio file:

python src/main.py authenticate --user_id john --audio path/to/audio.wav

Other Commands

List enrolled users:

python src/main.py list

Delete a user:

python src/main.py delete --user_id john

How It Works

Dual-Factor Authentication

DeepGuard implements two-factor voice authentication:

  1. Who you are - Speaker verification with ECAPA-TDNN model confirms your voice biometrics
  2. What you know - ASR with Wav2Vec2 confirms you're speaking the correct voice password

Both factors must match for successful authentication.

Voice Password Enrollment

During enrollment:

  1. Your voice is recorded and verified for quality
  2. A speaker embedding is extracted using ECAPA-TDNN
  3. Your spoken sentence is transcribed using Wav2Vec2 ASR
  4. Both are stored securely in your user profile

Authentication Process

During authentication:

  1. Your voice is recorded and checked for being a real human voice
  2. Speaker verification compares your voice to the stored embedding
  3. ASR transcribes your spoken password and compares to the stored password
  4. Authentication succeeds only if both voice AND password match

Advanced Usage

Command Line Options

usage: main.py [-h] [--config CONFIG] {enroll,authenticate,list,delete} ...

Voice-based authentication system

positional arguments:
  {enroll,authenticate,list,delete}
                        Command to execute
    enroll              Enroll a new user
    authenticate        Authenticate a user
    list                List enrolled users
    delete              Delete an enrolled user

optional arguments:
  -h, --help            show this help message and exit
  --config CONFIG       Path to configuration file

Enrollment Options

usage: main.py enroll [-h] --user_id USER_ID [--audio AUDIO] [--bypass_deepfake]

optional arguments:
  -h, --help            show this help message and exit
  --user_id USER_ID, -u USER_ID
                        Unique identifier for the user
  --audio AUDIO, -a AUDIO
                        Path to enrollment audio file (optional, will record if not provided)
  --bypass_deepfake, -b
                        Bypass deepfake detection (not recommended)

Authentication Options

usage: main.py authenticate [-h] --user_id USER_ID [--audio AUDIO] [--trust]

optional arguments:
  -h, --help            show this help message and exit
  --user_id USER_ID, -u USER_ID
                        User ID to authenticate
  --audio AUDIO, -a AUDIO
                        Path to audio file to use for authentication (optional, will record if not provided)
  --trust, -t           Trust the user and bypass some checks (not recommended)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Troubleshooting

File Permission Issues

If you encounter permission errors with audio files ("Operation not permitted" or "Permission denied"), try:

  1. Move your audio to the project directory:

    mkdir -p data/samples
    cp /path/to/your/audio.wav data/samples/
  2. Change file permissions:

    chmod 644 /path/to/your/audio.wav
  3. Run without sudo:

    # Run as regular user, NOT with sudo
    python src/main.py enroll --user_id your_id --audio_path data/samples/audio.wav

About

Voice Authentication and Deepfake detection system using AI models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages