请大神指教!too many values to unpack 错误

请大神指教,问题在哪呢?应该怎么改?
python 2.7
请问到底是哪里出现问题了呢?

import os
import sys
import numpy as np
from siplca import segmenter

sys.path.append('..')

wavfile = os.path.join('..', 'pythonProject3', 'data', 'WZP_02.wav')
rank = 4
win = 60
niter = 200
np.random.seed(123)
labels = segmenter.segment_wavfile(wavfile, win=win, rank=rank,
                                   niter=niter, plotiter=10)

按设计,应该返回类似于以下的列表:

<span class="go" style="color: rgb(48, 48, 48);">INFO:plca:Iteration 50: divergence = 9.468196</span>
<span class="go" style="color: rgb(48, 48, 48);">INFO:plca:Iteration 100: divergence = 9.421632</span>
<span class="go" style="color: rgb(48, 48, 48);">INFO:plca:Iteration 150: divergence = 9.409279</span>
<span class="go" style="color: rgb(48, 48, 48);">INFO:root:Iteration 199: final divergence = 9.404961</span>
<span class="go" style="color: rgb(48, 48, 48);">INFO:segmenter:Removing 2 segments shorter than 32 frames</span></pre>

但是,报错如下:

>>> runfile('/home/iuy/PycharmProjects/form_sip/run.py', wdir='/home/iuy/PycharmProjects/form_sip')
INFO segmenter 2021-10-07 22:56:07,203 segmenter.py:109  Extracting beat-synchronous chroma features from ../form_sip/data/WZP_02.wav
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/opt/pycharm-professional/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/home/iuy/PycharmProjects/form_sip/run.py", line 11, in <module>
    labels = segmenter.segment_wavfile(wavfile, win=win, rank=rank, niter=niter)
  File "/home/iuy/PycharmProjects/form_sip/segmenter.py", line 492, in segment_wavfile
    features, beattimes, songlen = extract_features(wavfile)
  File "/home/iuy/PycharmProjects/form_sip/segmenter.py", line 110, in extract_features
    x,fs = mlab.wavread(wavfilename, nargout=2)
ValueError: too many values to unpack

segmenter.py”, line 492, in segment_wavfile 的代码是:

features, beattimes, songlen = extract_features(wavfile)
    labels, W, Z, H, segfun, norm = segment_song(features, **kwargs)
    segments = convert_labels_to_segments(labels, beattimes, songlen)
    return segments

segmenter.py, line 110, in extract_features 的代码是:

 x,fs = mlab.wavread(wavfilename, nargout=2)
    feats,beats = mlab.chrombeatftrs(x.mean(1)[:,np.newaxis], fs, fctr, fsd,
                                     type, nargout=2)

请各位专家解答,谢谢!

讨论数量: 1
Jason990420

什么电脑系统 ? 安装了什么库 ?如何安装的 ? 哪个版本 ?

2周前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!