简体   繁体   English

一维卷积神经网络

[英]1D Convolutional Neural Network

I need to test CNN on EEG data, and I have heard that 1D-CNN is useful for real-time application.我需要在 EEG 数据上测试 CNN,我听说 1D-CNN 对实时应用很有用。 I have 5 test subjects with data from 3 sessions each.我有 5 个测试对象,每个对象的数据来自 3 个会话。 Each file contain signal from 56 electrodes/channels (56, 260).每个文件包含来自 56 个电极/通道 (56, 260) 的信号。

I am struggling to find how to set up the CNN and how to input data should be transformed.我正在努力寻找如何设置CNN以及如何转换输入数据。

model = Sequential()
model.add(Conv1D(filters=64, kernel_size=3, activation='relu', input_shape=input_shape))

How do I choose the input shape for 1DCNN from (15, 56, 260)?如何从 (15, 56, 260) 中选择 1DCNN 的输入形状?

So, for a Keras convolution, you should keep it this way: (examples, time_steps, features) .因此,对于 Keras 卷积,您应该保持这种方式: (examples, time_steps, features)

Where:在哪里:

  • examples (usually called samples, but not to be confused with your sensor samples) - they are the number of examples you have for your model: 15示例(通常称为样本,但不要与您的传感器样本混淆)-它们是您的模型的示例数量:15
  • time_steps: the continuous sequential measure of your sensors: 260 time_steps:传感器的连续顺序测量:260
  • features (also channels): the number of independent/parallel channels: 56功能(也通道):独立/并行通道的数量:56

Your data then should be shaped as (15,260,56) .您的数据应该被塑造为(15,260,56)

If you already have it organized as (15,56,260) , you need to permute or transpose it, not reshape.如果您已经将其组织为(15,56,260) ,则需要对其进行置换或转置,而不是重塑。 You can try numpy.swapaxes() .你可以试试numpy.swapaxes()

Once your data is organized corretly as (15, 260, 56) , you can create your network with input_shape=(260,56) , or even input_shape=(None, 56) in case you want variable length sequences.一旦您的数据正确地组织为(15, 260, 56) ,您可以使用input_shape=(260,56)甚至input_shape=(None, 56)创建您的网络,以防您需要可变长度序列。


This is also the same shape you need if you want to try recurrent networks, or even mix recurrent with conv1d.如果您想尝试循环网络,甚至将循环与 conv1d 混合,这也是您需要的相同形状。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM