Giter VIP home page Giter VIP logo

gender-recognize-by-voice's Introduction

Gender Recognition using Voice

This repository is about building a deep learning model using TensorFlow 2 to recognize gender of a given speaker's audio. Read this tutorial for more information.

Requirements

  • TensorFlow 2.x.x
  • Scikit-learn
  • Numpy
  • Pandas
  • PyAudio
  • Librosa

Cloning the repository:

git clone https://github.com/x4nth055/gender-recognition-by-voice

Installing the required libraries:

pip3 install -r requirements.txt

Dataset used

Mozilla's Common Voice large dataset is used here, and some preprocessing has been performed:

  • Filtered out invalid samples.
  • Filtered only the samples that are labeled in genre field.
  • Balanced the dataset so that number of female samples are equal to male.
  • Used Mel Spectrogram feature extraction technique to get a vector of a fixed length from each voice sample, the data folder contain only the features and not the actual mp3 samples (the dataset is too large, about 13GB).

If you wish to download the dataset and extract the features files (.npy files) on your own, preparation.py is the responsible script for that, once you unzip it, put preparation.py in the root directory of the dataset and run it.

This will take sometime to extract features from the audio files and generate new .csv files.

Training

You can customize your model in utils.py file under the create_model() function and then run:

python train.py

Testing

test.py is the code responsible for testing your audio files or your voice:

python test.py --help

Output:

usage: test.py [-h] [-f FILE]

Gender recognition script, this will load the model you trained, and perform
inference on a sample you provide (either using your voice or a file)

optional arguments:
-h, --help            show this help message and exit
-f FILE, --file FILE  The path to the file, preferred to be in WAV format
  • For instance, to get gender of the file test-samples/27-124992-0002.wav, you can:

    python test.py --file "test-samples/27-124992-0002.wav"
    

    Output:

    Result: male
    Probabilities:     Male: 96.36%    Female: 3.64%
    

    There are some audio samples in test-samples folder for you to test with, it is grabbed from LibriSpeech dataset.

  • To make inference on your voice instead, you need to:

    python test.py
    

    Wait until you see "Please speak" prompt and start talking, it will stop recording as long as you stop talking.

    אביעד ודביר הוא המלך של העולם הזה!

gender-recognize-by-voice's People

Contributors

x4nth055 avatar dvirgev avatar

Watchers

Aviad_Gilboa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.