dcase-repo / dcase_util Goto Github PK
View Code? Open in Web Editor NEWA collection of utilities for Detection and Classification of Acoustic Scenes and Events
Home Page: https://dcase-repo.github.io/dcase_util/
License: MIT License
A collection of utilities for Detection and Classification of Acoustic Scenes and Events
Home Page: https://dcase-repo.github.io/dcase_util/
License: MIT License
When trying to execute the tag_gmm and sed_gmm examples an AttributeError: 'dict' object has no attribute 'lower' occurs.
tag_gmm and sed_gmm examples
The console output is: .
[I] Learning
[I] ========================================
[I] Fold 1
[E] Uncaught exception (logging.py:221)
File ".....\dcase_util\utils\files.py", line 758, in detect_based_on_filename
extension = os.path.splitext(filename.lower())[1]
AttributeError: 'dict' object has no attribute 'lower'
Windows-10-10.0.14393-SP0
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
NumPy 1.17.1
SciPy 1.3.1
Matplotlib 3.1.1
librosa 0.7.0
NoModuleFoundError
raised when using dcase_util.utils.is_jupyter()
and other functions calling it.
import dcase_util.utils
print(dcase.util.utils.is_jupyter())
If there is no Jupyter or IPython installed, it should show
False
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "<path to conda environment>/lib/site-packages/dcase_util/utils/utils.py", line 191, in is_jupyter
from IPython import get_ipython
ModuleNotFoundError: No module named 'IPython'
conda 4.9.0
Python 3.8.12 (default, Oct 12 2021, 03:01:40) [MSC v.1916 64 bit (AMD64)]
NumPy 1.19.2
SciPy 1.8.0
Matplotlib 3.5.1
librosa 0.9.1
Note: no IPython
module installed in this environment.
It tried from IPython import get_ipython
, if get_ipython
dose not exist, it will catch a NameError
and return False
.
However, this actually assumes that there is IPython
. If IPython or Jupyter is not installed, an ModuleNotFoundError
will be raised and cannot be correctly caught.
Change line https://github.com/DCASE-REPO/dcase_util/blob/master/dcase_util/utils/utils.py#L208 to be
except (ModuleNotFoundError, NameError):
Traceback (most recent call last):
File "D:/py_code/firstpython/venv/first_python/test.py", line 4, in
import sed_eval
ImportError: No module named sed_eval
I am trying to run the event roll code from dcase repo and getting the error "QuadMesh' object has no attribute yaxis" for the line event_roll.plot()
Traceback (most recent call last):
File "D:/py_code/firstpython/venv/first_python/test_file.py", line 25, in
db.initialize()
File "D:\learn_program\Python27\lib\site-packages\dcase_util\datasets\datasets.py", line 566, in initialize
self.load()
File "D:\learn_program\Python27\lib\site-packages\dcase_util\datasets\datasets.py", line 408, in load
self.load_meta()
File "D:\learn_program\Python27\lib\site-packages\dcase_util\datasets\datasets.py", line 421, in load_meta
self.meta_container.load()
File "D:\learn_program\Python27\lib\site-packages\dcase_util\containers\metadata.py", line 899, in load
with open(self.filename, 'rtU') as f:
ValueError: Invalid mode ('rbt')
There is an example how to load youtube videos in dcase_util tutorials. Actually this code does not work, when executed on Windows machine.
Just execute:
audo_container = dcase_util.containers.AudioContainer().load_from_youtube(
query_id='2ceUOv8A3FE',
start=1,
stop=5,
silent=False
)
Download youtube item : 0.00B [00:00, ?B/s]
Download youtube item : 1%|7 | 16.0/1.11k [00:00<00:17, 61.8B/s]
Download youtube item : 14%|#######6 | 160/1.11k [00:00<00:10, 86.7B/s]
Download youtube item : 95%|#################################################4 | 1.06k/1.11k [00:00<00:00, 123B/s]
Download youtube item : 3.36kB [00:00, 176B/s]
Download youtube item : 7.44kB [00:00, 251B/s]
Download youtube item : 13.1kB [00:00, 357B/s]
Download youtube item : 19.6kB [00:03, 484B/s]
Download youtube item : 25.5kB [00:03, 689B/s]
Download youtube item : 29.3kB [00:05, 818B/s]
Download youtube item : 34.3kB [00:07, 1.04kB/s]
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\dcase_util\containers\audio.py in load_from_youtube(self, query_id, start, stop, mono, silent)
1052 quiet=True,
-> 1053 callback=callback
1054 )
C:\ProgramData\Anaconda3\lib\site-packages\pafy\backend_shared.py in download(self, filepath, quiet, progress, callback, meta, remux_audio)
663 else:
--> 664 os.replace(temp_filepath, filepath)
665
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\mzaremba\\AppData\\Local\\Temp\\tmpwmvukw04.webm.temp' -> 'C:\\Users\\mzaremba\\AppData\\Local\\Temp\\tmpwmvukw04.webm'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
<ipython-input-33-39ba8ece2da0> in <module>()
3 start=1,
4 stop=5,
----> 5 silent=False
6 )
C:\ProgramData\Anaconda3\lib\site-packages\dcase_util\containers\audio.py in load_from_youtube(self, query_id, start, stop, mono, silent)
1094 except (IOError, BadStatusLine, ExtractorError) as e:
1095 # Store files with errors
-> 1096 raise IOError(e.message)
1097
1098 except (KeyboardInterrupt, SystemExit):
AttributeError: 'PermissionError' object has no attribute 'message'
Windows-10-10.0.14393-SP0
Python 3.6.5 |Anaconda custom (64-bit)| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
NumPy 1.14.1
SciPy 1.0.1
Matplotlib 2.2.2
librosa 0.6.0
I try to use dcase util in notebook but get this error
import dcase_util
ModuleNotFoundError: No module named 'dcase_util'
the I check, I already install it
!pip install dcase_util
Requirement already satisfied: dcase_util in /home/xxxx/anaconda3/envs/pytorch/lib/python3.8/site-packages (0.2.18)
Load from youtube is not working
audio_container = dcase_util.containers.AudioContainer().load_from_youtube(
query_id='2ceUOv8A3FE',
start=1,
stop=5
)
ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:815 in wrapper
return func(self, *args, **kwargs)
File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:836 in __extract_info
ie_result = ie.extract(url)
File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\extractor\common.py:534 in extract
ie_result = self._real_extract(url)
File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\extractor\youtube.py:1794 in _real_extract
'uploader_id': self._search_regex(r'/(?:channel|user)/([^/?&#]+)', owner_profile_url, 'uploader id') if owner_profile_url else None,
File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\extractor\common.py:1012 in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_youtube_dl.py:40 in _fetch_basic
self._ydl_info = ydl.extract_info(self.videoid, download=False)
File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:808 in extract_info
return self.__extract_info(url, ie, download, extra_info, process)
File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:824 in wrapper
self.report_error(compat_str(e), e.format_traceback())
File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:628 in report_error
self.trouble(error_message, tb)
File ~\AppData\Local\anaconda3\Lib\site-packages\youtube_dl\YoutubeDL.py:598 in trouble
raise DownloadError(message, exc_info)
DownloadError: ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ~\AppData\Local\anaconda3\Lib\site-packages\dcase_util\containers\audio.py:1182 in load_from_youtube
youtube_audio = pafy.new(
File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_shared.py:386 in getbestaudio
if not self.audiostreams:
File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_shared.py:176 in audiostreams
self._process_streams()
File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_youtube_dl.py:81 in _process_streams
self._fetch_basic()
File ~\AppData\Local\anaconda3\Lib\site-packages\pafy\backend_youtube_dl.py:43 in _fetch_basic
raise IOError(str(e).replace('YouTube said', 'Youtube says'))
OSError: ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
Cell In[41], line 1
audio_container = dcase_util.containers.AudioContainer().load_from_youtube(
File ~\AppData\Local\anaconda3\Lib\site-packages\dcase_util\containers\audio.py:1263 in load_from_youtube
raise IOError(e.message)
AttributeError: 'OSError' object has no attribute 'message'
The link 'https://yt-dl.org/update' answer 'Access denied'
Windows-10-10.0.19045-SP0
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
NumPy 1.24.1
SciPy 1.10.1
Matplotlib 3.7.1
librosa 0.10.0.post2
config =tf.compat.v1.ConfigProto(
inter_op_parallelism_threads=BLAS_thread_count
)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import logging
logging.getLogger('tensorflow').setLevel(logging.FATAL)
with SuppressStdoutAndStderr():
from keras import backend as k
session =tf.compat.v1.Session()(config=config)
dcase_util/dcase_util/keras/utils.py
Line 312 in 0e35c3c
File "/src/task1a.py", line 683, in do_learning
print_indent=2
File "/usr/local/lib/python3.6/dist-packages/dcase_util/decorators/decorators.py", line 14, in call
return self.f(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/dcase_util/keras/utils.py", line 308, in setup_keras
keras.backend.tensorflow_backend.set_session(tf.Session(config=config))
UnboundLocalError: local variable 'keras' referenced before assignment
Cannot plot an audio container
audio_container = dcase_util.containers.AudioContainer().load( filename=dcase_util.utils.Example.audio_filename())
audio_container.plot()
Traceback (most recent call last):
Cell In[38], line 1
audio_container.plot()
File ~\AppData\Local\anaconda3\Lib\site-packages\dcase_util\containers\audio.py:1808 in plot
self.plot_wave(**kwargs)
File ~\AppData\Local\anaconda3\Lib\site-packages\dcase_util\containers\audio.py:1925 in plot_wave
from librosa.display import waveplot
ImportError: cannot import name 'waveplot' from 'librosa.display'
Windows-10-10.0.19045-SP0
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
NumPy 1.24.1
SciPy 1.10.1
Matplotlib 3.7.1
librosa 0.10.0.post2
The latest librosa depends on llvmlite, which is broken with LLVM 6.0.0, which means it's not possible to import dcase_util when installing from source. This is necessary when working on a platform which doesn't have precompiled binaries. Please consider downgrading librosa.
LLVM issue references:
https://bugs.llvm.org/show_bug.cgi?id=35947
https://reviews.llvm.org/D44140
Install dcase_util from source:
pip install -v --ignore-installed --no-binary :all: dcase_util
import dcase_util
Should be able to import dcase_util.
$ python
Python 2.7.11 (default, May 25 2016, 14:24:28)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dcase_util
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/short/wa66/rk9125/lib/python2.7/site-packages/dcase_util/__init__.py", line 6, in <module>
from . import containers
File "/short/wa66/rk9125/lib/python2.7/site-packages/dcase_util/containers/__init__.py", line 948, in <module>
from .audio import *
File "/short/wa66/rk9125/lib/python2.7/site-packages/dcase_util/containers/audio.py", line 11, in <module>
import librosa
File "/short/wa66/rk9125/lib/python2.7/site-packages/librosa/__init__.py", line 12, in <module>
from . import core
File "/short/wa66/rk9125/lib/python2.7/site-packages/librosa/core/__init__.py", line 102, in <module>
from .time_frequency import * # pylint: disable=wildcard-import
File "/short/wa66/rk9125/lib/python2.7/site-packages/librosa/core/time_frequency.py", line 10, in <module>
from ..util.exceptions import ParameterError
File "/short/wa66/rk9125/lib/python2.7/site-packages/librosa/util/__init__.py", line 70, in <module>
from . import decorators
File "/short/wa66/rk9125/lib/python2.7/site-packages/librosa/util/decorators.py", line 9, in <module>
from numba.decorators import jit as optional_jit
File "/short/wa66/rk9125/lib/python2.7/site-packages/numba/__init__.py", line 10, in <module>
from . import config, errors, runtests, types
File "/short/wa66/rk9125/lib/python2.7/site-packages/numba/config.py", line 11, in <module>
import llvmlite.binding as ll
File "/short/wa66/rk9125/lib/python2.7/site-packages/llvmlite/binding/__init__.py", line 6, in <module>
from .dylib import *
File "/short/wa66/rk9125/lib/python2.7/site-packages/llvmlite/binding/dylib.py", line 4, in <module>
from . import ffi
File "/short/wa66/rk9125/lib/python2.7/site-packages/llvmlite/binding/ffi.py", line 128, in <module>
raise e
OSError: /short/wa66/rk9125/lib/python2.7/site-packages/llvmlite/binding/libllvmlite.so: undefined symbol: LLVMInitializeInstCombine
NumPy 1.11.0
SciPy 1.1.0
Matplotlib 1.5.1
librosa 0.6.0
audio_container.plot_spec() crashes if I print some values before
The following works fine:
audio_container = dcase_util.containers.AudioContainer().load(
filename=dcase_util.utils.Example.audio_filename())
audio_container.show()
# plot spectrogram
audio_container.plot_spec()
But the following craches :
audio_container = dcase_util.containers.AudioContainer().load(
filename=dcase_util.utils.Example.audio_filename())
audio_container.show()
# plot spectrogram
print(audio_container.set_focus(start_seconds=5, duration_seconds=2.0, channel='left').get_focused().shape)
audio_container.plot_spec()
C:\Users\fa125436\AppData\Local\Programs\Python\Python39\lib\site-packages\librosa\core\spectrum.py:256: UserWarning: n_fft=2048 is too large for input signal of length=1
warnings.warn(
Traceback (most recent call last):
Cell In[63], line 1
audio_container.plot_spec()
File ~\AppData\Local\anaconda3\Lib\site-packages\dcase_util\containers\audio.py:2072 in plot_spec
ax = plt.subplot(self.channels, 1, channel_id+1)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\pyplot.py:1323 in subplot
key = SubplotSpec._from_subplot_args(fig, args)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\gridspec.py:598 in _from_subplot_args
raise ValueError(
ValueError: num must be an integer with 1 <= num <= 2, not 3
Windows-10-10.0.19045-SP0
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
NumPy 1.24.1
SciPy 1.10.1
Matplotlib 3.7.1
librosa 0.10.0.post2
Error when running the asc_gmm.py
example on Windows 10, asc_gmm_simple.py
runs just fine. Does it need to be modified before hand? Are there any extra steps that I did not understand?
I'm just reporting this because I think examples should be easy to use and learn from, it is not an urgent bug, but it should help newcomers (such as me) to get started with the lib.
Thanks for your time developing this library.
Run python dcase_util\examples\asc_gmm.py
.
Unkown.
Daniel@DANIEL-ASUS D:\Documents\GitHub\dcase_util\examples
> python asc_gmm.py
[I] Acoustic Scene Classification Example / GMM
[E] Path: Unknown data type for paths. (files.py:393)
NoneType: None
Traceback (most recent call last):
File "asc_gmm.py", line 75, in <module>
dcase_util.utils.Path().create(param['path'].values())
File "D:\Programs\Miniconda3\lib\site-packages\dcase_util\utils\files.py", line 394, in create
raise ValueError(message)
ValueError: Path: Unknown data type for paths.
>>> import platform; print(platform.platform())
Windows-10-10.0.16299-SP0
>>> import sys; print("Python", sys.version)
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
>>> import numpy; print("NumPy", numpy.__version__)
NumPy 1.14.2
>>> import scipy; print("SciPy", scipy.__version__)
SciPy 1.0.1
>>> import matplotlib; print("Matplotlib", matplotlib.__version__)
Matplotlib 2.2.2
>>> import librosa; print("librosa", librosa.__version__)
librosa 0.6.0
Just in case you don't see it, I've also opened an issue on the DCASE2017-baseline-system repo. It is not related to this one, but occurs on the example code, too.
I got an issue
urllib.error.URLError: urlopen error timed out
when I try to execute:
python asc_gmm_simple.py
However, my network connection is fine when visiting other websites. I think perhaps the reason is the network connection is weak ? Is there a mirror source of the dataset? Or is it for other reasons? Thanks for help!
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.