Audio Classifier in Keras using Convolutional Neural Network
DISCLAIMER: This code is not being maintained. Your Issues will be ignored. For up-to-date code, switch over to Panotti.
Audio Classifier in Keras using Convolutional Neural Network
License: MIT License
Audio Classifier in Keras using Convolutional Neural Network
DISCLAIMER: This code is not being maintained. Your Issues will be ignored. For up-to-date code, switch over to Panotti.
Dear Professor, Thank you for the excellent tutorial.
For sample data, i created two folders and put one set of sounds in each folder.
Step 1 went well.
man@man:~/Downloads/audio-classifier-keras-cnn-master$ python preprocess_data.py
class_names = ['tring', 'hold']
class name = tring - 0, 9 files in this class
Loading class: tring ( 1 of 2 classes), file 1 of 9: Samples/tring/r4.wav
class name = hold - 1, 94 files in this class
Loading class: hold ( 2 of 2 classes), file 1 of 94: Samples/hold/hm1_081.mp3
Loading class: hold ( 2 of 2 classes), file 21 of 94: Samples/hold/hm1_011.mp3
Loading class: hold ( 2 of 2 classes), file 41 of 94: Samples/hold/hm1_020.mp3
Loading class: hold ( 2 of 2 classes), file 61 of 94: Samples/hold/hm1_077.mp3
Loading class: hold ( 2 of 2 classes), file 81 of 94: Samples/hold/hm1_043.mp3
STEP TWO ERROR
man@man:~/Downloads/audio-classifier-keras-cnn-master$ python train_network.py
Using TensorFlow backend.
class_names = ['tring', 'hold']
total files = 103
get_sample_dimensions: melgram.shape = (1, 1, 96, 32)
Loading class: tring ( 1 of 2 classes), file 1 of 9: Preproc/tring/r6.wav.npy
Traceback (most recent call last):
File "train_network.py", line 201, in <module>
X_train, Y_train, paths_train, X_test, Y_test, paths_test, class_names, sr = build_datasets(preproc=True)
File "train_network.py", line 147, in build_datasets
X_train[train_count,:,:] = melgram
ValueError: could not broadcast input array from shape (1,96,25) into shape (1,96,32)
man@man:~/Downloads/audio-classifier-keras-cnn-master$
What is meant by ValueError: could not broadcast input array from shape (1,96,25) into shape (1,96,32)
How do I resolve it?
Hi Dr. Hawley,
I noticed a small problem in the code in both train_network and eval_network- there is no error handling for files that produce spectrograms smaller than width 1293. This happens leads when the training data is created from the mel spectrograms (X_train[train_count,:,:] = melgram, around line 140).
You have written code to chop off the extra width if it is too long ( melgram = melgram[:,:,:,0:mel_dims[3]] ) but nothing to account for melgrams being too short.
I was able to get around it by filling the empty space with 0's, but I thought it would be helpful to let you know!
Also- if you are interested, I would love to connect with you sometime to talk about potential ways to extend this example/model to a system that works in real time, and makes predictions on songs as it hears them through a computer microphone versus an uploaded mp3.
My email is [email protected] if you want to connect!
Thanks,
Aaron
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.