fastlib / fCWT

The fast Continuous Wavelet Transform (fCWT) is a library for fast calculation of CWT.
Apache License 2.0
263 stars 53 forks source link

fCWT vs STFT in CNN-based EEG emotion recognition #41

Open fastlib opened 1 year ago

fastlib commented 1 year ago
          Understood. Thanks a lot for the clarification. Furthermore, I have a few more confusion that I would also like to ask for your expert opinions, 

Currently, I'm trying to build CNN-based eeg emotion recognition model with CWT, STFT, and fCWT respectively, and compare the performance of each model with different methods. However, I found that the performance of STFT is better than CWT (the parameters of both methods have been tuned to the highest performance on CNN). Therefore, would like to ask, if it is possible that using STFT on a narrow band frequency signal such as the Alpha band of an eeg signal will provide better performance than CWT ?

Originally posted by @whip123 in https://github.com/fastlib/fCWT/issues/40#issuecomment-1623880692

fastlib commented 1 year ago

It is not possible to answer your question without more information. Can you specify model architecture, STFT and fCWT parameters, datasets, frequency range, performances, statistical significance of these tests, etc.

whip123 commented 1 year ago

The EEG signal that I used is the Alpha band(8-12Hz) of the difference between 2 eeg signals with a sampling frequency of 200Hz (SEED dataset). To have a fair comparison between fCWT and STFT, I have tried to generate the spectrogram with different window lengths (Hanning window) that range from 5 to 13 seconds with 50% overlapping. Coming to fCWT, I have also tried to generate scalograms with different sigma values ( 10, 15, 20 ,25, 30) (Morlet Wavelet) and set the number of frequencies to 480, frequency limits = 0.25 to 20. All the generated scalograms and spectrograms will then be fed into the pre-trained CNN model for training and determining which data set has the highest accuracy. Consequently, I found that spectogram with 11 seconds window length and scalogram with a sigma value of 20 has the highest accuracy. But the model trained with spectrogram has higher accuracy than the model trained with Scalogram

fastlib commented 1 year ago

Thank you for the information.

Can you post time-frequency plots of both techniques on a small segment of EEG data?

Additionally, what are the performances and what is their statistical significance? Did you do multiple runs of both models or is this based on one run?

whip123 commented 1 year ago

Sure, the following are the plots of both techniques

STFT (window length = 11 seconds) (Accuracy = 75%) image fCWT (sigma = 20) (Accuracy = 70%) image

As the available data is very limited. Hence, all these results are based on one run and the accuracy difference between these 2 techniques is around 5%.

fastlib commented 1 year ago

Alright, we do see more detail in the fCWT analysis, which is what you would expect. My best guess, is that the difference in classification is because your CNN model overfits on the extra amount of detail the fCWT provides. That in combination with your statement of the limited data, I would advice against using a CNN on raw time-frequency spectra. Use the time-frequency spectrum as input for further feature extraction to reduce dimensionality in the search space. Does that makes sense?

whip123 commented 1 year ago

Yeah, it makes sense to me. Apart from using the Alpha band eeg, I also have tried using EEG signals with all frequency bands on the same experiment, and the difference between fCWT and STFT is a lot bigger as shown below.

STFT (window length = 0.07 seconds) (Accuracy = 56.7%) image fCWT(Sigma = 2 ) (Accuracy =61.7%) image

Could this suggest that, for this method, the STFT is able to extract the frequency effectively due to the narrow band frequency? However, for wideband frequency, the fCWT is more suitable. Although the resolution of fCWT is higher than the STFT. But the resolution difference between the 2 is not as big as compared to the one with all frequency bands eeg.