The aim of this project is to be able to detect sounds made by a car horn using Edge Impulse embedded machine learning solution.
We are using the UrbanSound8K dataset to train our neural network.
You will need to create an account on EdgeImpulse first. It is also recommended to follow their tutorial on sound recognition to start with.
The project is based on ST Discovery kit IOT node but it should work with any other supported hardware.
- Download the UrbanSound8K following this link and unzip its content
- Rename file
credentials.json.template
tocredentials.json
- Update the json file with your EdgeImpulse credentials (api key, hmac key, device name)
- Install python
librosa
andrequests
packages
The script wavToEdgeImpulse.py
imports wav files from UrbanSound8K dataset and convert files to mono/16kHz format. They are uploaded to EdgeImpulse ingestion service in both training and testing datasets.
Some important variables and functions in the script:
- TESTING_SPLIT: part of files to consider as testing dataset. By default set to 25% (75% for training set)
- getWaveFiles(LABEL, 600, 0.5): by default we import 600 seconds of data , from which 50% is consider foreground sound.
The script may run for a couple of minutes as a few hundreds samples have to be converted and uploaded to the ingestion service. All samples will then appear in your Edge Impulse dashboard.
- Import some reference background noise or additional UrbanSound8K labels to complete neural network training
- Add field results
- Adapt default firmware to continously monitor sound from ST IOT kit
- J. Salamon, C. Jacoby and J. P. Bello, "A Dataset and Taxonomy for Urban Sound Research", 22nd ACM International Conference on Multimedia, Orlando USA, Nov. 2014.
- Gideon Mendels, How to apply machine learning and deep learning methods to audio analysis