lgeo3 / protolab_sound_recognition Goto Github PK
View Code? Open in Web Editor NEWsound recognition in python
License: MIT License
sound recognition in python
License: MIT License
Hi,
Thanks for sharing your work. I'm trying to install your repo but I can't get it to work. when running the test I get this error. I hope you can help
ImportError while importing test module '/home/gbernal/protolab_sound_recognition/tests/test_bell_detection.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_bell_detection.py:7: in
from sound_classification import classification_service
sound_classification/classification_service.py:20: in
from sound_classification.generate_database_humavips import generate_aldebaran_dataset
sound_classification/generate_database_humavips.py:8: in
from sound_processing.features_extraction import extract_mfcc_features_one_channel, _flatten_features_dict
sound_processing/features_extraction.py:7: in
from features import mfcc, logfbank, fbank # to compute mel frequency we use this package -> https://github.com/jameslyons/python_speech_features
E ImportError: No module named features
------------------------------------------------------------------- Captured stderr -------------------------------------------------------------------
/home/gbernal/.local/lib/python2.7/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
/home/gbernal/.local/lib/python2.7/site-packages/sklearn/grid_search.py:42: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20.
DeprecationWarning)
python setup.py develop --user does not work here.
Moreover, I get error with pytest on some computer..
this slow down process on small configuration (it's a flask option to disable like debug mode if I remember correctly)
Hi, I'm trying to run the flask service as the documentation says
mkdir data python flask_restful_app/api.py -w "path_to_the_sound_dataset/*/*.wav"
but this error appears
`root@3e6acd2b253a:/protolab_sound_recognition# python flask_restful_app/api.py -w "/dataset//.wav"
/opt/conda/lib/python2.7/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
/opt/conda/lib/python2.7/site-packages/sklearn/grid_search.py:42: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20.
DeprecationWarning)
/root/.local/lib/python2.7/site-packages/scikits/audiolab/soundio/play.py:48: UserWarning: Could not import alsa backend; most probably, you did not have alsa headers when building audiolab
warnings.warn("Could not import alsa backend; most probably, "
args is Namespace(pickle_file=None, pickle_out_file='/tmp/classif.pickle', wav_files=['/dataset//.wav'])
CLF is SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma='auto', kernel='rbf',
max_iter=-1, probability=True, random_state=None, shrinking=True,
tol=0.001, verbose=False)
ERROR on /dataset//.wav
Traceback (most recent call last):
File "/protolab_sound_recognition/sound_classification/generate_database_humavips.py", line 43, in _generate_aldebaran_dataset
signal, fs = load_sound(f)
File "/protolab_sound_recognition/sound_processing/io_sound.py", line 14, in load_sound
f = Sndfile(filename, 'r')
File "_sndfile.pyx", line 488, in scikits.audiolab.pysndfile._sndfile.Sndfile.init (scikits/audiolab/pysndfile/_sndfile.c:4251)
IOError: error while opening /dataset//.wav
->error while opening file /dataset//.wav
-> System error : No such file or directory.
Traceback (most recent call last):
File "flask_restful_app/api.py", line 62, in
api.sound_classification_obj.learn()
File "/protolab_sound_recognition/sound_classification/classification_service.py", line 87, in learn
window_block=self.window_block_learning)
File "/protolab_sound_recognition/sound_classification/generate_database_humavips.py", line 66, in generate_aldebaran_dataset
df['features'] = df['features'].apply(lambda x : _flatten_features_dict(x))
File "/opt/conda/lib/python2.7/site-packages/pandas/core/frame.py", line 1964, in getitem
return self._getitem_column(key)
File "/opt/conda/lib/python2.7/site-packages/pandas/core/frame.py", line 1971, in _getitem_column
return self._get_item_cache(key)
File "/opt/conda/lib/python2.7/site-packages/pandas/core/generic.py", line 1645, in _get_item_cache
values = self._data.get(item)
File "/opt/conda/lib/python2.7/site-packages/pandas/core/internals.py", line 3590, in get
loc = self.items.get_loc(item)
File "/opt/conda/lib/python2.7/site-packages/pandas/core/indexes/base.py", line 2444, in get_loc
return self._engine.get_loc(self._maybe_cast_indexer(key))
File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 154, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1210, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1218, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'features'`
I've been attempting to get this project up and running for a few days now and finally have it running. I'm now attempting to create my own dataset of wav files... I'd like to use this code to recognize when my washer/dryer are finished and send myself a message.
I've learned a few things as I go... like the file names need to be in the format of XXXX-YYYY-ZZZZZ where XXXX is the class name, YYYYY is a counter, and ZZZZZ is something else... But I don't know what. My theory is that it's the name of some sound recognition algorithm you're telling it to use but this is just a guess. Could you expand on what the third "fold" of the filename is supposed to be?
For anyone else who comes by I've also learned that all wav files used need to be recorded at 48000 sample rate and you need to have more than one file to represent each class of sound.
Thanks!
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.