ppwwyyxx / speaker-recognition

A Speaker Recognition System
Apache License 2.0
675 stars 275 forks source link

ValueError: need at least one array to concatenate #17

Closed richardpenner closed 7 years ago

richardpenner commented 7 years ago

I'm seeing the following crash when trying to enroll:

Traceback (most recent call last):
  File "./speaker-recognition.py", line 89, in <module>
    task_enroll(args.input, args.model)
  File "./speaker-recognition.py", line 71, in task_enroll
    m.enroll(label, fs, signal)
  File "/Users/richardpenner/Downloads/speaker-recognition-master/src/gui/interface.py", line 60, in enroll
    feat = mix_feature((fs, signal))
  File "/Users/richardpenner/Downloads/speaker-recognition-master/src/gui/feature/__init__.py", line 26, in mix_feature
    mfcc = MFCC.extract(tup)
  File "/Users/richardpenner/Downloads/speaker-recognition-master/src/gui/feature/MFCC.py", line 128, in extract
    ret = get_mfcc_extractor(fs, **kwargs).extract(signal)
  File "/Users/richardpenner/Downloads/speaker-recognition-master/src/gui/feature/MFCC.py", line 70, in extract
    feature = row_stack(feature)
  File "/Users/richardpenner/PROJECTS/miniconda2/envs/speaker3/lib/python2.7/site-packages/numpy/core/shape_base.py", line 230, in vstack
    return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
ValueError: need at least one array to concatenate

Any ideas what might be wrong?

ppwwyyxx commented 7 years ago

What's the command you used? And could you ls the data directory you used to show that you have the files in the correct place? There is some tricky point about the organization of directories.

richardpenner commented 7 years ago

The command I ran was:

./speaker-recognition.py -t enroll --input "./waves-enroll/*" --model model.out

and the contents of ./waves-enroll is 2 directories: ben and james. Each of those 2 directories have hundreds of files named as, for example,

B-10_00m_00s__00m_01s.mp3.wav
B-10_00m_01s__00m_02s.mp3.wav
B-10_00m_02s__00m_03s.mp3.wav
…
ppwwyyxx commented 7 years ago

The files look correct. Another reason is that some of your files may be too short. I just added a line in 593425851e to check this.

richardpenner commented 7 years ago

Thank you. I split the wav files into 1 second each, based on a comment you made somewhere, but now I wonder if you're creating 1s samples internally and the wav files can be longer?

richardpenner commented 7 years ago

You were correct – some of the files were too short. I was using 1 second waves based on a misunderstanding of something you wrote elsewhere. Using longer input waves is now working. Thank you!