I already wrote about classifiers before in this article and how they work. To summarize, A classifier is an algorithm that sorts data into labeled classes or categories of information. They usually work by using machine learning algorithms to learn and help classify data better (learn more about machine learning in this article). Machine Learning are computer algorithms that work to help computers learn without human intervention. They work to help the classify train to help become better at classifying data.
What did I use
To train the model, I used Create ML, which is Apple’s machine learning application. Create ML uses transfer learning, which is when it takes other algorithms to create their machine learning models. This application is great as you could create and make machine learning models easily. You could create image classifiers, recommenders, object classification, motion classifiers, etc. This application is very versatile and easy to put into application to use. For this model, I used a sound classifier.
How I trained the model
To create this, I had to create a machine learning model. Now for this model, I had to start by creating training data (in this article, I talk more about training data while creating a machine learning model). To summarize, training data is what allows the model to learn to classify data. For this training data, I got all the audio samples from this website. For this website, I downloaded over 1,000 files. I made five folders labeled happy, sad, neutral, angry, and fear. Each of these files has around 400 files each. Each class has files of men, women, different ages, and dialects expressing the emotion. This set had a lot of variation and it made a good set to train and make a good model.
I also created testing data from the same website. It also had variation and was a good way to test the model and make sure that it works well. Once I got the training data done, I was able to put it into Create ML to build the model.
How does the model work
Now, let’s talk about how the model trains the data. Although there are many ways to classify sound, most of them use something called deep neural networks. Deep Neural Networks use a series of input and output layers.
1. AI for CFD: Intro (part 1)
2. Using Artificial Intelligence to detect COVID-19
3. Real vs Fake Tweet Detection using a BERT Transformer Model in few lines of code
4. Machine Learning System Design
They have the input layer, output layer, and a bunch of hidden layers that help classify the data into the layers. They are loosely based on the human brain and how it works. Here’s another article I wrote that explains a little more on how classification works. Here’s an article I wrote that talks about the different types of classifiers (Click here).
The testing phase
Once the model finished testing, I had to put it into testing. To test it, I had to upload the testing file, have the model guess what it is, and decide if it was good and it needed more testing. If there was one class that the model had trouble guessing, I would go back to the training data and add more files or delete files that may have caused the model to get less accurate results. Then I would make a model and retrain. I repeated the process until the model was perfect.
For this app, I wanted to create an app that easily displayed how my model works so that other people could see how it works as well. You can read the article here. I liked the design they created for the app as it was simple, colorful, and easy to display the goal of what my article created. I highly recommended reading this article to learn more about how the guy created the app.
I’m not going to explain the coding process that much since you could read more about it in the article I linked above. To summarize what I wrote, I built the app to listen to your tone, and based on what it hears, it will display the name of the emotion associated with a certain color. In the end, the app should look something like this: