Bug in Cepstral Extractor

14 views
Skip to first unread message

Francesco Tuveri

unread,
Oct 21, 2016, 12:53:29 PM10/21/16
to bob-devel
I think there is some numeric issue with the MFCC calculations. I am using the Python API of bob.bio.spear to extract MFCCs and sometimes I get zero-valued coefficients from a signal, even from segments of the signal where there is no silence.
The problem happens when I pass to bob.bio.spear.extractor a signal is scaled to [0,1]. For example I read 16 bit PCM files and scale them with the following code:

signal = np.memmap(file_path, dtype='h', mode='r') #signal is an array of type np.int16
signal
= signal.astype(np.float)
signal
/= 2. ** 15
With this code, for some PCM files I get a lot of zero-valued MFCCs, even for the part of the signal where there is no silence.

This problem does not happen if i don't scale the signal and just pass the np.int16 array (casted to float just to be safe) to the MFCC extractor.

Elie Khoury

unread,
Oct 21, 2016, 1:01:36 PM10/21/16
to bob-...@googlegroups.com
There is no numerical issues with the MFCC calculations: the MFCC extraction in bob.bio.spear is coupled with the wave reader of spear, that is the scipy wave reader.
If you want to implement your own wave reader, make sure to convert the output to match the scipy wave reader output.


--
-- You received this message because you are subscribed to the Google Groups bob-devel group. To post to this group, send email to bob-...@googlegroups.com. To unsubscribe from this group, send email to bob-devel+unsubscribe@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/bob-devel or directly the project website at http://idiap.github.com/bob/
---
You received this message because you are subscribed to the Google Groups "bob-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bob-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Francesco Tuveri

unread,
Oct 21, 2016, 1:19:18 PM10/21/16
to bob-devel
Thanks. Where can I find some source code about the wave reader of spear? Do you perform some manipulation on scipy wave reader output, or you just pass it as it is to the MFCC extractor?


On Friday, October 21, 2016 at 7:01:36 PM UTC+2, Elie Khoury wrote:
There is no numerical issues with the MFCC calculations: the MFCC extraction in bob.bio.spear is coupled with the wave reader of spear, that is the scipy wave reader.
If you want to implement your own wave reader, make sure to convert the output to match the scipy wave reader output.

On Fri, Oct 21, 2016 at 12:53 PM, Francesco Tuveri <ftu...@gmail.com> wrote:
I think there is some numeric issue with the MFCC calculations. I am using the Python API of bob.bio.spear to extract MFCCs and sometimes I get zero-valued coefficients from a signal, even from segments of the signal where there is no silence.
The problem happens when I pass to bob.bio.spear.extractor a signal is scaled to [0,1]. For example I read 16 bit PCM files and scale them with the following code:

signal = np.memmap(file_path, dtype='h', mode='r') #signal is an array of type np.int16
signal
= signal.astype(np.float)
signal
/= 2. ** 15
With this code, for some PCM files I get a lot of zero-valued MFCCs, even for the part of the signal where there is no silence.

This problem does not happen if i don't scale the signal and just pass the np.int16 array (casted to float just to be safe) to the MFCC extractor.

--
-- You received this message because you are subscribed to the Google Groups bob-devel group. To post to this group, send email to bob-...@googlegroups.com. To unsubscribe from this group, send email to bob-devel+...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/bob-devel or directly the project website at http://idiap.github.com/bob/

---
You received this message because you are subscribed to the Google Groups "bob-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bob-devel+...@googlegroups.com.

Elie Khoury

unread,
Oct 21, 2016, 1:36:35 PM10/21/16
to bob-...@googlegroups.com
It's inside utils/
```
 import scipy.io.wavfile
  rate, audio = scipy.io.wavfile.read(filename)

  # We consider there is only 1 channel in the audio file => data[0]
  data= numpy.cast['float'](audio)
```

--
-- You received this message because you are subscribed to the Google Groups bob-devel group. To post to this group, send email to bob-...@googlegroups.com. To unsubscribe from this group, send email to bob-devel+unsubscribe@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/bob-devel or directly the project website at http://idiap.github.com/bob/

---
You received this message because you are subscribed to the Google Groups "bob-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bob-devel+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages