How to train cnn using short time Fourier transform(stft) of time series dataset

I have time series . I have applied stft using scipy library. how to make dataset for stft matrix of shape 65*90 to train cnn and find best architecture for classification using cnn.

Sander Dieleman wrote a blogpost about his approach at Spotify here. It’s a bit old by now, but it still might give you some ideas to work with your data.

Hi Ptrblck,

when get a spectrogram or FFT, its array is complex-number, could you give some suggestions to deal with it in pytorch?

Because pytorch do not support convert complex numpy array to torch tensor.

Thank you very much!

use only magnitude of spectrogram or fourier transform.

abs(fft)

or you could make it a two channel tensor with one channel being the real part and the other channel being the imaginary part.

2 Likes