SuperBruceJia / EEG-Motor-Imagery-Classification-CNNs-TensorFlow

EEG Motor Imagery Tasks Classification (by Channels) via Convolutional Neural Networks (CNNs) based on TensorFlow
https://iopscience.iop.org/article/10.1088/1741-2552/ab4af6/meta
204 stars 47 forks source link

Data processing before entering CNN #5

Closed zhouyanghuang1 closed 3 years ago

zhouyanghuang1 commented 3 years ago

Hello, I would like to ask if you split the 23-by-640 time-frequency diagram obtained after the combined time-frequency analysis into 23 32-by-20 recompositions and put them into CNN?

SuperBruceJia commented 3 years ago

Yep. The 23 X 640 matrix has been processed as 23 32 X 20 matrixes. The reasons why we are doing it:

  1. Dataset Extension, i.e., we can have many more data, which is essential to Deep Learning-based methods, e.g., CNNs.
  2. A novel way to process the signals. In detail, first of all, we processed the temporal signals into time-frequency maps, i.e., the time X frequency matrixes. Then, we decomposed them as time X single-frequency matrixes. Last but not least, a CNN architecture was proposed to decode the EEG tasks.
  3. The results outperform that regarding the 23 X 640 matrix based on CNN models.

If u have additional questions, let me know.

Best,

Shuyue

zhouyanghuang1 commented 3 years ago

Thank you very much for taking time out of your busy schedule to dispel doubts!

There's one more thing I don't know: The time-frequency diagram obtained after combined time-frequency analysis is of the order of magnitude around 10E-22, but the order of magnitude of the single-frequency matrix is around 10E0. I want to know how does this step actually translate?

Thank you

SuperBruceJia commented 3 years ago

Thank you very much for taking time out of your busy schedule to dispel doubts!

There's one more thing I don't know: The time-frequency diagram obtained after combined time-frequency analysis is of the order of magnitude around 10E-22, but the order of magnitude of the single-frequency matrix is around 10E0. I want to know how does this step actually translate?

Thank you

Hi,

You should double-check the codes, especially the pre-processing one from line 81 to 86 as an example. After we got the time-frequency maps, we normalized the singles in order to better train the Deep Neural Networks. The reason why we normalized the signals was that a single neuron in the DNN was activated by a non-linear function, a.k.a, activation function, like Sigmoid or ReLu, and if the intensity of signals is too large, the gradient (derivative) of the function w.r.t. the signals will be extremely small, which would lead to the gradient vanishing problem. That's why the Normalization (e.g., Batch Normalization) was used for Data Input and Data Processing in the network.

If u have additional questions, let me know.

Best,

Shuyue

maqsood-shah-uncc commented 3 years ago

I tried many times in python 2.7, but every time it gives the following error.

return np.array(trials, dtype=np.float64).reshape((len(trials),) + trials[0].shape + (1,)), np.array(labels, dtype=np.float64) IndexError: list index out of range