Giter Site home page Giter Site logo

berkedabag / gender-recognition-by-voice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from troboto/gender-recognition-by-voice

0.0 0.0 0.0 12.48 MB

Predict the speaker's gender from an audio file (Flask API included)

License: MIT License

Python 9.17% Jupyter Notebook 90.83%

gender-recognition-by-voice's Introduction

Gender Recognition by Voice

MIT License

Table of Contents

Description

The aim of this project is to develop a model that can take a waveform as its input and output speaker’s gender, whether male or female. The developed model is trained on the Common Voice dataset, which can be found here. It includes more than 70,000 records of male and female from different countries.

The project includes a flask localhost API that eases the use of the final model. The final model, XGBoost, managed to achieve an accuracy of 97.1% on the test set, which is almost perfect.

The code used for training can be found in the src folder.

For more details about the project and the procedure I followed to develop this model, refer to report.pdf, which can be found in the main repo.

NOTE : If you want to train and test models, you can use the features I extracted from the dataset from here. Don't forget to put them in src/results

Support!
If you find this project helpful, please support me by starring this repository.

Instructions

Installation

  1. Download this repository or clone it using:
git clone https://github.com/TRoboto/Gender-Recognition-by-Voice
  1. Change the current working directory to the code location, run:
cd Gender-Recognition-by-Voice/src
  1. Download the required dependencies, run:
pip install -r requirements.txt
  1. Install FFmpeg library:

    • For Anaconda:
    conda install -c conda-forge ffmpeg
    
    • Others:
    pip install ffmpeg
    

How to use

  1. Start flask localhost server, run:
python app.py

You should see something like this:

* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
  1. Open the server in the browser like this:
http://127.0.0.1:5000/predict?audio_file=file_location

Replace file_location with the location of an audio file on your pc like this:

http://127.0.0.1:5000/predict?audio_file=C:\my_voice.m4a

NOTE: You can use Voice Recorder app to record five seconds of your voice and then, save it and test it.

  1. If everything is working as expecting, you should see the output as follows:
{
"response":{
	"audio_file":"C:\\my_voice.m4a",
	"female":"0.9750009160488844",
	"male":"0.024999084",
	"time_taken":"0.6616175174713135"
	}
}

where the value of female/male is the probability of being female/male.

the probability of male = 1 - the probability of female

gender-recognition-by-voice's People

Contributors

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