gpt4 book ai didi

python - librosa.display.waveplot(np.array(f),sr=22050)-----AttributeError : 'module' object has no attribute 'display'

转载 作者:太空狗 更新时间:2023-10-30 01:50:17 24 4
gpt4 key购买 nike

引用此链接:https://aqibsaeed.github.io/2016-09-03-urban-sound-classification-part-1/ ,我试图制作相同的波形图,但是,我通过 .py 运行代码,出现错误:

(tensorflow) yyydeMacBook-Pro:~ yyy$ python /Users/yyy/Desktop/1.py 
Traceback (most recent call last):
File "/Users/yyy/Desktop/1.py", line 82, in <module>
plot_waves(sound_names,raw_sounds)
File "/Users/yyy/Desktop/1.py", line 42, in plot_waves
librosa.display.waveplot(np.array(f),sr=22050)
AttributeError: 'module' object has no attribute 'display'

最佳答案

从这里github issue我读到现在有必要 import librosa.display

[更新 2022] 显然现在 waveplot 也需要更改为 waveshow,如下所示:(感谢 Hammad Hassan 的评论!)

import librosa.display
plt.figure(figsize=(12, 4))
librosa.display.waveshow(data, sr=sampling_rate)

关于python - librosa.display.waveplot(np.array(f),sr=22050)-----AttributeError : 'module' object has no attribute 'display' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43533023/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com