1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] ValueError: Invalid dtype: complex64 when using get_melspectrogram_layer in Kapre

Discussão em 'Python' iniciado por Stack, Setembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    I'm trying to use the get_melspectrogram_layer from the Kapre library in a Keras model. However, I'm encountering the following error:

    ValueError: Exception encountered when calling STFT.call().
    Invalid dtype: complex64


    Here's the code I'm using:

    input_shape = (int(16000*1.0), 1)

    mel_spectogram_layer = get_melspectrogram_layer(input_shape=input_shape,
    n_mels=128,
    pad_end=True,
    n_fft=512,
    win_length=400,
    hop_length=160,
    sample_rate=16000,
    return_decibel=True,
    input_data_format='channels_last',
    output_data_format='channels_last')


    The error traceback points to an issue with the complex64 dtype:

    Invalid dtype: complex64

    Arguments received by STFT.call():
    • args=('<KerasTensor shape=(None, 16000, 1), dtype=float32, sparse=None, name=keras_tensor_13>',)
    • kwargs=<class 'inspect._empty'>


    I have tried casting the output to float32 after the Mel-spectrogram layer, but the error persists. How can I resolve this issue? Is there a way to handle the complex64 dtype within the STFT or Mel-spectrogram layers in Kapre?

    Any help would be appreciated!

    I wanted to use the kapre library to preprocess the audio files into melspectograms and pass it to the CNN model that I have written

    Continue reading...

Compartilhe esta Página