![]() ![]() īased on code from here: I was able to follow and use the simplicity of Keras to process my files. Up until then, I had never used Keras but had heard of it. ![]() I am not ashamed to say it took a while and I learned a lot. Next I needed some code to take the files and build a model. Parent_dir = 'C:\\Users\\ksaye\\Desktop\\'įilecount = len(os.listdir(parent_dir + source_dir))įor f in os.listdir(parent_dir + source_dir): Here is some python code that evenly distributes the files with labels from 0 to 9: Example: XXXXX-1.wav, XXXXY-2.wav, XXXXZ-3.wav where the number is the label, as shown below: Next I took all of these audio files and labeled them. Here is the bash script I run, via /etc/rc.local:Īrecord -D plughw:1 -duration=15 -f cd -vv $ Restart the swap service: /etc/init.d/dphys-swapfile stop & /etc/init.d/dphys-swapfile startĪpt-get install raspberrypi-kernel-headersĪpt-get install -y python python-dev python-pip build-essential swig git libpulse-dev libasound2-dev portaudio19-dev # buy the device: Įxpand the SWAP space: /etc/dphys-swapfile Here are my notes on installing the drivers and writing a simple bash script that runs ‘arecord’ to record samples. For this, I used a Raspberry Pi Zero and a, total expense ~$30. ![]() For my use case, I just sampled 560 audio files over ~30 days, knowing that each day an approximate amount of water has evaporated. Part 2 – Is the Fountain full of water, the hard wayįirst, we need lots of wave files and a label on each.Is the Fountain full of water, the hard way.This is part three of three other blogs, and finally the completion: My goal is this “how, using sound, can I predict if my water fountain is full?” Classification - normally image, but in this case, audio - allows us to do this. Thanks to both Keras and Xianshun Chen, we can now train an audio file (wav file) into a model and classify against it in just a few lines of code. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |