Skip to content

Namste! I developed this project during my 6 months internship at IIT Jammu. Baby Cry Project is developed using ML and Deep Learning models to classify the baby cry into 5 different categories viz. bellypain, burping, discomfort, hungry and tired.

Notifications You must be signed in to change notification settings

RuchiRaina3/Baby-Cry-Classifier

Repository files navigation

Baby-Cry-Project

I developed this project along with my peer during my 6 months internship at IIT Jammu. Baby Cry Classifier is built using ML and Deep Learning models to classify the baby cry into 5 different categories viz. bellypain, burping, discomfort, hungry and tired.

Data Collection

Data is in the form of audio files. We have taken the data from donateacry and we have also collected real-time data from the hospitals and parents.

Statistics of data:

  • bellypain = 80
  • burping = 40
  • discomfort = 135
  • hungry = 80
  • tired = 80

Data Preparation

This module is coded to bring uniformity in data in order to prepare it for training. To bring uniformity, we will make all folders to have 80 audio files. All audios are longer than 5 seconds and maximum lie between 5-7 seconds Now, what to do is:

  • For all folders except burping: We will extract starting 2.5 seconds of audio files and store them in the new location
  • For burping: As its number is only 40, so to make them 80, we will extract starting 2.5 seconds as well as next 2.5 seconds of audio and store these two created files in the new location. This will result in 80 files of burping.

We will also keep a check if files have not exceeded the count of 80 because discomfort has 135 files and we want only 80.

Packages/Libraries Used : from pydub AudioSegment, librosa, pandas
Visit Module


We have trained two models for this project:

  1. Naive Bayes Classifier : This was to dip our hands in ML
  2. Neural Network : To get ourselves completely drenched in ML and Deep Learning

Features Extraction

This module is for extracting features for Naive Bayes Classifier.
For Naive Bayes Model, features extracted are:

  • rms energy: Root Mean Square of energy is equals to sqrt(sum(energy**2))/len(energy))
  • zcr: Zero Cross Rate is the rate at which a signal changes from positive to zero to negative or from negative to zero to positive. In simpler words, it's the rate at which the signal passes through the origin.

After extracting features, these features will be used to create the dataframe.
Dataframe has the following columns:

  • Energy
  • ZCr
  • label

Each category is assigned an integer which is the label for that category.

  • bellypain - 1
  • burping - 2
  • discomfort - 3
  • hungry - 4
  • tired - 5

After that dataframe is converted to an excel sheet.
Also, data is split into train and test dataset. For that I have made the use of dataframe.drop function. For test data, 15 random samples have been taken from each category.

Finally, train dataframe and test dataframe are converted to excel sheet.

Packages/Libraries Used : numpy, librosa, pandas, math
Visit Module

Naive Bayes Classifier

This module contains the code for Naive Bayes Classifier. It is divided into 5 steps.
STEP 1: READING EXCEL SHEETS
STEP 2: DERIVING STATISTICS(mean, std. deviation, length) OF COLUMNS - ENERGY & ZCR TO SUMMARIZE DATASET
STEP 3: SUMMARIZE DATASET BY CLASS
STEP 4: CALCULATING GAUSSIAN PROBABILITY DISTRIBUTION FUNCTION
STEP 5: CALCULATE PROBABILITIES
1. Calculate Class prob. i.e. P(class) = Rows in class / Total Rows in training Dataset
2. Calculate Prob. for each input value in the row using the Gaussian probability density function and the statistics for that column and of that class

Packages/Libraries Used : numpy, librosa, pandas, math
Visit Module

Accuracy is not much impressive. It's just 50.667%.
So, we decided to use the Neural Network for classification.

Neural Network

This module contains the code for Classification using Sequential Neural Network.

It has five layers. First four layers have relu activation function and fifth layer has the softmax activation function.

Firstly, features are extracted. Features extracted are MFCC. Mel-frequency cepstral coefficients (MFCCs) are coefficients that collectively make up an MFC. For that I have used librosa.feature.mfcc(). It will return 125 MFCCs.

Then these features are fed into the neural network. It is trained for 3000 epochs.

Packages/Libraries Used : numpy, librosa, pandas, math, keras, tensorflow
Visit Module

Accuracy is 83.529%. It's much impressive for this size of data.

About

Namste! I developed this project during my 6 months internship at IIT Jammu. Baby Cry Project is developed using ML and Deep Learning models to classify the baby cry into 5 different categories viz. bellypain, burping, discomfort, hungry and tired.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published