This project implements a machine learning model to predict gender based on voice features using the XGBoost classifier. The system includes components for recording and processing audio data, extracting features, and predicting gender with high accuracy. It provides tools for GUI interactions, QR code generation, and more, offering a comprehensive solution for voice-based gender prediction.
- Voice Feature Extraction: Extracts key acoustic features from audio files for use in gender prediction.
- Voice Recording: Captures audio data using a microphone and saves it as a WAV file.
- Gender Prediction: Utilizes an XGBoost classifier to predict gender based on extracted voice features.
- GUI Tools: Provides various GUI components, including a custom spinbox, modern windows, and a countdown timer.
- QR Code Generation: Generates and saves QR codes based on input data.
- Secret Code Generation: Creates a 48-character alphanumeric secret code.
Ensure that the following Python packages are installed:
- Python 3.6 or higher
scipy
librosa
pydub
pyaudio
xgboost
sklearn
pandas
tkinter
customtkinter
qrcode
secrets
Install Dependencies
pip install scipy librosa pydub pyaudio xgboost scikit-learn pandas customtkinter qrcode secrets
-
Extract Acoustic Features
Use the
acausticfeatersextract.py
script to extract features from an audio file:from acausticfeatersextract import extract_features features = extract_features("your_audio_file.mp3")
-
Record Your Voice
Use the
recorder.py
script to record your voice:python recorder.py
This will record your voice and save it as
recorded_voice.wav
. -
Train the Model
Run the
XGBmodel.py
script to train the XGBoost model on thevoice.csv
dataset:python XGBmodel.py
The model will be trained, and you can use the
xgb_predict
function to make predictions. -
Make Predictions
After training, use the
xgb_predict
function to predict gender based on the extracted features:from XGBmodel import xgb_predict prediction = xgb_predict(features) print(f"Predicted Gender: {prediction}")
The project comprises the following key components:
acausticfeatersextract.py
: Handles acoustic feature extraction from audio files.recorder.py
: Manages voice recording and file saving.timer.py
: Implements a countdown timer using customtkinter.tools.py
: Contains utility functions for QR code generation, secret code creation, and GUI components.XGBmodel.py
: Includes data preprocessing, model training, and gender prediction using XGBoost.
This project is licensed under the MIT License.
For any inquiries, feel free to contact yacermeftah@gmail.com.