Since my family has started going to school and work, my dog has started going crazy. During the quarantine, she got really attached and developed a separation anxiety. To solve that, we have to detect Clairette's barks when we're gone and respond to them using recordings of our voices.
How To Build1. Wire following the schematic.
2. Upload bark_listener.ino to Arduino Nano 33 BLE Sense.
3. Upload bark_audio_responder.ino to Arduino Nano.
4. Upload audio files to SD card.
5. Connect Music Maker Feather to AUX speaker.
6. Plug Arduino Nano 33 BLE Sense in.
7. Watch the barks stop!
Since there was no one big dataset good enough for dog bark detection, I used a couple. Ranked by importance in the model, the datasets I used are:
- Google Audioset: Bark
- My own data (dog barking and background noise around the house)
- Google Speech Command dataset
- Audio Cats and Dogs
I then used Shawn Hymel's keyword spotting dataset curation script to preprocess the data into one-second clips and add background noise. Every audio clip was then labeled as either "bark" or "other". I also had to do a lot of cleaning of the bark data as many clips from the Google Audioset did not have barks in them: I did this by listening to the audio samples labeled as other and reassigning them based on if they were actually barks or not).
I uploaded all the audio clips to Edge Impulse under their labels; I then used Edge Impulse's Eon Tuner to find and train the best model.
The raw audio is turned into a Mel-filterbank energy spectrogram, an image representation of audio used by the model. The picture below shows that the raw audio between the types does not look that different; the spectrograms make the similarities between the samples most apparent.
Edge Impulse exports an Arduino library that can be used with the Arduino Nano 33 BLE Sense. The library handles the conversion of the audio into a spectrogram and the model inference.
Responding To the BarksWhenever a bark is detected, a random track is played to respond to the dog. My dog is attached to my mom the most, so we recorded her. The tracks range from telling her to stop or telling her that it is okay.
I had to use an external Arduino Nano to control because the Nano 33 runs MBED OS, which doesn't have fast enough interrupts to control the audio (when using the Nano 33, the audio is very choppy).
Comments