1
$\begingroup$

I have an EEG dataset which is 64 channel data with 1000 data points. I am using mean and standard deviation to extract the time-domain features. I have a very basic question. Can I use CNN to get good classification results for such time-domain data?

I have calculated mean of each channel and subtracted it. I am taking standard deviation of each channel and then dividing each channel by SD. The CNN structure I am using is Conv1D. I know that generally EEG signal's feature extraction is done by taking its frequency features and time-frequency.

But I would like to know if some used just the time domain data and did CNN training on such data. It is really important for me to know.

I have edited the post to add the code. In this code I am trying to use CNN on 2 channels just to check if it works fine when merging the layers. The output is onehot encoded with 40 classes.

        from keras.models import Sequential, Model
        from keras.layers import Dense, Dropout, Flatten, Input, Embedding, concatenate
        from keras.layers import Conv1D
        from keras import optimizers

    inp1 = Input(shape=(1000, 1), dtype='float32', name='c1input')
    conv1 = Conv1D(128, kernel_size= 512, strides=256, input_shape=(1000, 1), name='audConv_l1')(inp1)
    conv1 = Flatten(name='audConv_l2')(conv1) 
    conv1 = Dropout(0.3, name='audConv_l3')(conv1) 
    a1 = Dense(256, activation='relu',name='rate_l1')(conv1)
    a1 = Dropout(0.15, name='rate_l2')(a1)



    inp2 = Input(shape=(1000, 1), dtype='float32', name='c2input')
    conv2 = Conv1D(128, kernel_size= 512, strides=256, input_shape=(1000, 1), name='audConv_21')(inp2)
    conv2 = Flatten(name='audConv_22')(conv2) 
    conv2 = Dropout(0.3, name='audConv_23')(conv2) 
    a2 = Dense(256, activation='relu',name='rate_21')(conv2)
    a2 = Dropout(0.15, name='rate_22')(a2)


    AV = concatenate([a1, a2], name='AVRate_l1')

    decOutput = Dense(40, activation='softmax', name='decOutput')
    model = Model(inputs=[inp1, inp2],outputs= decOutput)

    adam = optimizers.adam(lr=0.0001)
    model.compile(optimizer=adam, loss='mse',loss_weights=0.2, metrics=['accuracy'])
    print(model.summary())

    lb = scipy.io.loadmat('label.mat')
    label = lb['label']

    model.fit([c1,c2],label,batch_size=64, epochs=10, validation_data=None)

The code works fine but the accuracy is coming as 1.0000 which seems a little too right. I have made some mistake for sure but I cannot understand it. If someone faced the same problem. please let me know

$\endgroup$
  • $\begingroup$ The question is not clear. Yes and No. Please make clearer what you're trying to do, and preferably what your goal is. Time-series analysis is usually a different domain, with very different tools. But unless you make it clearer, what you're trying to achieve, no answer can be given. $\endgroup$ – cherub May 9 '18 at 12:25
0
$\begingroup$

I also work with EEG signals in CNNs, for my experience, what you are doing is basically standardizing each channel $X' = \frac{X-\mu}{\sigma}$ centers it to zero and normalizes the data, that is a good practise. In my experience, EEG signals are quite non-linear, therefore feeding them to a CNN is usually a good idea.

The main issue you will face is that it is difficult to obtain a number of samples (EEG recordings) big enough so that the network will be able to extract knowledge. Another suggestion I'd like to make would be to convert your signal to frequency domain, or even to time/freq domain (for example woth the spectrogram of the signal) since these transformations are non-trivial. And would help the network identify time/freq patterns in the EEG.

Hope this helps!

$\endgroup$
  • $\begingroup$ Yes. I know about the use of frequency domain or time-freq domain. My question still stands the same, will just the time data not give any information? I am already doing time-freq and freq domain. $\endgroup$ – Gala May 9 '18 at 12:06
  • $\begingroup$ It may give some info, the problem is that it will require more data to train since the problem (as my short experience suggests) will be more complex $\endgroup$ – Pablo Arnau González May 9 '18 at 13:28
  • $\begingroup$ Yes I get that but what structure to follow and what input kind of input has to be given. I have relevant data of 9 channels with 1000 timepoints. I want to know the kind of structure of data that should be given to CNN for time-domain data. Also the CNN structure. I have already made some model , but it is giving an accuracy of 1.00 which is not right. $\endgroup$ – Gala May 16 '18 at 6:22
  • $\begingroup$ The architecture of the network is imposible to determine, there are no laws on how to design CNNs. An accuracy of 1.00 (Over 1, I understand) seems fishy. Personally I would check that the samples presented for training, and test are different. You may have some overfitting there. if the accuracy is 1% then we go back to the main concern, you do not have enough data to train the network. Keep in mind deep architectures have millions of parameters and hence require from huge datasets if the problem is not trivial. How many classes do you have? $\endgroup$ – Pablo Arnau González May 16 '18 at 11:53
  • $\begingroup$ Regarding the structure, your tensor should have a shape of $Batch_size \times n_{time_length} \times n_{channels}$ $\endgroup$ – Pablo Arnau González May 16 '18 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.