☁ ModelArts ExeML Sound Classification with Cat and Dog dataset
In this article, I will try to explain how to use Huawei Cloud ModelArts Service for Sound Classification and make a demonstration with the Cat and Dog dataset from Kaggle. Let’s hop on to it.
Introduction
Sound Classification with ModelArts is an AI modeling service for Huawei Cloud that you can use to predict the classifications of a given audio data to the model.
For example, you can use it for predicting audios belonging to which bird species. First of all, you need a dataset of images that you want to predict. ModelArts suggests you have at least 100 audio for each class that you want to train. In this article, we are going to use a dataset from Kaggle which contains 85 dog and 125 cat audio files to train our model.
What is Kaggle? It is an online community of data scientists and machine learning engineers. Kaggle allows users to find datasets they want to use in building AI models, publish datasets, work with other data scientists and machine learning engineers, and enter competitions to solve data science challenges.
We have our dataset and we have our end-to-end AI Development platform ModelArts, so what are we waiting for? Let’s hop on to it!
Sound Classification
Data Preparation
Like We said before, first we need a dataset and we don’t want to collect all the images by ourselves. So we hop into Kaggle and find a suitable database.
Write to the search bar Cat-Dog Audio Dataset and click the first one below.
Download the dataset by clicking the Download button at the top right corner.
After downloading the dataset as a zip file, decompress it. Now we should upload our dataset to OBS to use these sound data to train our model.
Uploading Data to OBS
We are going to use obsutil solution for this task. If you don't know how to upload data to OBS with obsutil click the link for instructions.
If you don’t have a bucket in your Huawei Cloud OBS system, follow the instructions below and create one.
Log into your Huawei Cloud account and Click Object Storage Service from the Service List.
Click on Create Bucket from the top right corner of OBS Console.
Create your bucket with the configurations below.
Now we created our bucket. We can create a folder for our dataset and upload our audio files through obsutil.
Creating folders with the instructions below.
Use obsutil to upload your dataset to OBS with the instructions and CLI commands below.
obsutil cp [**YOUR TRAIN DATASET DIRECTORY**] obs://[**YOUR BUCKET NAME**] -r -f
As you can see from the OBS Console and CLI response, we successfully uploaded our data to the OBS service.
We created 2 new folders for the ModelArts ExeML service. One for input and one for output.
We are done with uploading our dataset to OBS. So we can hop on to ModelArts service and integrate our OBS data to ModelArts service to train our model.
ModelArts integration with OBS and Model Training
Come back to the Service List and find ModelArts service.
Select ExeML from left navigation bar and Create a Sound Classification project.
Give your exeML project and dataset a name and select the input and output paths from the OBS service.
Click Create Now after that.
After the exeML project is created, go back to the ModelArts console and hop on to the Dataset section from Data Management. Find your dataset and click its name.
On the opening page, click the default labeling job.
Click Add Data dropdown box and Add data again.
Set the configurations below and insert your OBS path which contains the real training data.
Now our OBS data is integrated with the ModelArts dataset and we can see our data on both Dataset and ExeML sections.
Go back to the ModelArts console ExeML section and click your ExeML project.
As you can see we have our data here too. If everything is fine from here, click the train button from the top right corner and start the model training.
Model Deployment
After a while, the training is over, we can see the metrics of our training and model. Now we are ready to deploy our model to test. Click the Deploy button like below.
After one or two minutes deployment has been completed. We can either test our model through the ModelArts console like I am going to do it right now or use API at the below right corner.
Model Testing
Let’s upload our test data and test it.
Our model works just fine for the effort we give! You can try different test datas on the model.
Conclusion
In this article, we trained a Sound classification model with Huawei Cloud ModelArts service. We used a public dataset of Cat-Dog Audio datas from Kaggle and trained it to classificate these two animals by their voices.
As you can see you can easily create Sound classification models with Huawei Cloud ModelArts service and deploy it. You can combine this service with other services to make more complex projects. ModelArts allows you to use this deployed model with API Reference.