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.
- 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
- Python 3.7+
- PyTorch
- SpeechBrain
- HuggingFace Transformers
- Sounddevice or PyAudio (for microphone recording)
- See requirements.txt for full dependencies
- Clone the repository:
git clone https://github.com/yourusername/deepguard-voice.git
cd deepguard-voice- Install dependencies:
pip install -r requirements.txtEnroll a user using microphone input:
python src/main.py enroll --user_id johnThis will:
- Open your microphone and prompt you to speak your voice password
- Record your voice for about 5 seconds
- Extract speaker embeddings for voice biometrics
- Transcribe your spoken sentence as your voice password
- Store both for future authentication
Or enroll using an existing audio file:
python src/main.py enroll --user_id john --audio path/to/audio.wavAuthenticate using microphone input:
python src/main.py authenticate --user_id johnThis will:
- Open your microphone and prompt you to speak your voice password
- Verify BOTH your voice biometrics AND your spoken password match
- 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.wavList enrolled users:
python src/main.py listDelete a user:
python src/main.py delete --user_id johnDeepGuard implements two-factor voice authentication:
- Who you are - Speaker verification with ECAPA-TDNN model confirms your voice biometrics
- What you know - ASR with Wav2Vec2 confirms you're speaking the correct voice password
Both factors must match for successful authentication.
During enrollment:
- Your voice is recorded and verified for quality
- A speaker embedding is extracted using ECAPA-TDNN
- Your spoken sentence is transcribed using Wav2Vec2 ASR
- Both are stored securely in your user profile
During authentication:
- Your voice is recorded and checked for being a real human voice
- Speaker verification compares your voice to the stored embedding
- ASR transcribes your spoken password and compares to the stored password
- Authentication succeeds only if both voice AND password match
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
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)
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)
This project is licensed under the MIT License - see the LICENSE file for details.
- SpeechBrain for the ECAPA-TDNN model
- HuggingFace for the Wav2Vec2 model
- PyTorch for the deep learning framework
If you encounter permission errors with audio files ("Operation not permitted" or "Permission denied"), try:
-
Move your audio to the project directory:
mkdir -p data/samples cp /path/to/your/audio.wav data/samples/
-
Change file permissions:
chmod 644 /path/to/your/audio.wav
-
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