Some links for recognizing dog bark. In short, it is possible with the simple detection of sound amplitude or more complicated with deep learning. There are guidelines and models alreay available, which looks possible to pursue:
There is an available Python package named BarkTracker to detect pet's noise by setting up a certain level of decibels. This is simple but has a high risk of catching wrong sound/noice or not catching dog bark: https://pypi.org/project/BarkTracker/
Work with big training data (6GB) takes much more time than usual. Strategy to overcom:
Extract sample data in a smaller volumne from the main data. After the codes run smoothly without error, we then switch to big dataset
When coding, divide codes into smaller modules and work with each small module first before moving on to the next one.
Conflictions of library package version:
Machine learning and deep learning involve quickly. The project use tensorflow developed by Google which is updated regularly and some latest is not compatible with previousone. Also the code is working with Python 3.6 but not working with Python 3.8 and some IDE, ie. Jupyter Notebook, are not working with the code due to this issue of version confliction.
Solution: Setup the environment with proper python and package versions
Use Python virtual environment.
Enforce the installation of Python 3.6, tensorflow 1.14
In Python file, set the paths for the audio and metadata files.
# Set the path to the full UrbanSound dataset
fullDataSetPath = 'd:/temp/UrbanSound8K/audio/'
metaDataPath = 'd:/temp/UrbanSound8K/metadata/UrbanSound8K.csv'
The UrbanSound8K has 8732 files. In our Python file, we can set the dataCount variable to load all data, or just some of them.
# Set amount data to load for training and validating
dataCount = 10000
Training result
Accuracy to recognize 10 classes. Our predicting code will utilize that result and predict dog bark positively if the dog bark percentage is higher than 50%.:
Training accuracy: 93%
Testing accuracy: 88%
Output files in the working folder:
dog-bark.pickle: It is the trained model, which can be used for future prediction with other wav files.
Training once, use forever!
Compressed 6GB of data into 1MB trained model!
list.csv: It includes 10 classes of the Urbansound dataset
Accuracy of the current model with the current dataset is 80-85%. Such accuracy would be improved further.
Deep learning model: Due to the scope of this project, we do not intend to re-invent the wheel, thus employ the existing model. More reasearch of models and optimization of hyper-parameters of the models would improve the accuracy further.
Dataset:
Dataset plays a vital role in the accuracy. Current model is trained with dataset UrbanSound8K with 8732 labeled sound excerpts divided into 10 cateogories. The data is not specifically for Australia urban, and some categories, such as gunshot, are not very relevant.
Bigger dataset would improve the accuracy. The bigger dataset can be from the existing dataset in internet or from data collection when the device are used and more sounds are recorded. To use the recorded data for further training the model, data needs to be QAQC and labeled.
Keep updating the model with more data when devices are used. This can be done by either:
Compile new data with previous data and train the model again.
Or use Transferred Learning, which is to train the new data with the trained model
Or use Federated Learning, which is to train the model with the small dataset in the device, then send the trained result back to server on the cloud to compile and train again.
Adversarials input:
It is the knowned issue of deep learning, which the machine cannot recognize the accuracy issue while it is very obvious with human.
This is the active research area, whose result might help to improve the accuracy of this model.