sakethgsharma / HotWordDetection

Course project for SDES-2016, IITB
27 stars 17 forks source link

FutureWarning: in the future, full(1, 0) will return an array of dtype('int32') #2

Open lkathke opened 7 years ago

lkathke commented 7 years ago

After training and running checkHotword.py, I have got the following error:

C:\Users\lasse\Desktop\HotWordDetection-master\HotWordDetection-master>python bin/checkHotword.py C:\Python27\lib\site-packages\numpy\core\numeric.py:301: FutureWarning: in the future, full(1, 0) will return an array of dtype('int32') format(shape, fill_value, array(fill_value).dtype), FutureWarning) Traceback (most recent call last): File "bin/checkHotword.py", line 9, in <module> hwDet = hd.hwDetector() File "C:\Users\lasse\Desktop\HotWordDetection-master\HotWordDetection-master\hotword_detection\hwDetector.py", line 46, in __init__ MFCC_MATRIX = np.empty([39, num_frames]) ValueError: negative dimensions are not allowed

HawaiianHeir commented 6 years ago

I have also run into this issue. i am currently unable to find the solution, as i am still quite new to programming, and would love to receive feedback on the matter.

I do believe there is an issue with the MFCC MATRIX? seems to be overflowing or not properly receiving the np.array?

"""" def init(self, alpha=0.95, N=256, fs=8000, eps=10e-6, frame_dur=0.025): self.alpha = alpha #Preemphasis parameter self.N = N # No of FFT points self.eps = eps # eps to avoid mathematical errors self.fs = fs self.mfcc_frame_length = round(fs*frame_dur) #frame length for mfcc self.prev_frame = np.zeros((14,)) self.prev_prev_frame = np.zeros((14,))

    def generate_filter_bank(self, num_filters=23, lower_freq=300, upper_freq=3800):
            """
            This function computes the Mel filterbank. The filters are stored in rows, the columns 
            correspond
            to DFT bins. The filters are returned as a matrix of size nfilt * (nfft/2 + 1)

            :param num_filters: Number of filters in the Mel filterbank
            :type num_filters: int
            :param lower_freq: Lower frequency from where the first filter should start
            :type lower_freq: int
            :param upper_freq: Upper frequency where the last filter should end. Should be less than (fs/2)
            :type upper_freq: int
            :returns: Matrix containing filterbank weights
            :rtype: matrix

            """
            self.highfreq = upper_freq
            assert self.highfreq <= self.fs/2, "highfreq is greater than samplerate/2"

            # compute points evenly spaced in mels
            self.lowmel = self.hz2mel(lower_freq)
            self.highmel = self.hz2mel(upper_freq)
            self.melpoints = np.linspace(self.lowmel,self.highmel,num_filters+2)
            self.bin = np.floor((self.N+1)*self.mel2hz(self.melpoints)/self.fs)

            self.fbank = np.zeros([num_filters, self.N/2+1])
            for j in range(0,num_filters):
                    for i in range(int(self.bin[j]), int(self.bin[j+1])):
                            self.fbank[j,i] = (i - self.bin[j]) / (self.bin[j+1]-self.bin[j])
                    for i in range(int(self.bin[j+1]), int(self.bin[j+2])):
                            self.fbank[j,i] = (self.bin[j+2]-i) / (self.bin[j+2]-self.bin[j+1])
                    return self.fbank

""""

HawaiianHeir commented 6 years ago

any insight yet as to why this error occurs when running 'checkHotword.py'?