Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'Melspectrogram' #119

Open
ghassan100 opened this issue Feb 21, 2021 · 3 comments
Open

ImportError: cannot import name 'Melspectrogram' #119

ghassan100 opened this issue Feb 21, 2021 · 3 comments

Comments

@ghassan100
Copy link

from kapre.time_frequency import Melspectrogram, Spectrogram

@kenders2000
Copy link
Contributor

I believe this API is a deprecated, you will want to use ApplyFilterbank instead, from the docstring:

input_shape = (2048, 1)  # mono signal
n_fft = 1024
n_hop = n_fft // 2
kwargs = {
    'sample_rate': 22050,
    'n_freq': n_fft // 2 + 1,
    'n_mels': 128,
    'f_min': 0.0,
    'f_max': 8000,
}
model = Sequential()
model.add(kapre.STFT(n_fft=n_fft, hop_length=n_hop, input_shape=input_shape))
model.add(Magnitude())
# (batch, n_frame=3, n_freq=n_fft // 2 + 1, ch=1) and dtype is float
model.add(ApplyFilterbank(type='mel', filterbank_kwargs=kwargs))
# (batch, n_frame=3, n_mels=128, ch=1)

@bagustris
Copy link

bagustris commented Aug 5, 2021

Is the following layer is the replacement?
composed_melgram_layer = kapre.composed.get_melspectrogram_layer(input_shape=(44100, 1))

I am also looking for a compatible replacement for the Melspectrogram layer.

Any information is appreciated.

@keunwoochoi
Copy link
Owner

keunwoochoi commented Aug 5, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants