# How to implement 1D Convolutional Autoencoder with multiple channels? [closed]

I want to build a 1D convolution autoencoder with 4 channels in Keras. Instead of images with RGB channels, I am working with triaxial sensor data + magnitude which calls for 4 channels. I haven't seen much information on this and I am not fully sure how to incorporate the channel information for constructing the network.

Each example is 100 data points, and 4 channels (x, y, z, mag) so the input is of shape (100,4). Since it's not image data but rather each axis is 1D sensor data, I want to just use 1D convolutions. I am not super concerned with the autoencoder architecture (what I have below is just an example I implemented quickly), but I do want to understand how to implement a 1D convolution autoencoder using multiple channels. This is what I have so far, but I am not sure it is incorporating the channels correctly so I'd love feedback on this! While the final output from the decoder is of shape (100,4), is that the correct way to reconstruct the original input?

# Encoder
encoder = Conv1D(50, 12, activation = 'relu', padding = 'same')(input_layer)
encoder = MaxPooling1D(4, padding = 'same')(encoder)

# Decoder
decoder = Conv1D(50, 12, activation = 'relu', padding = 'same')(encoder)
decoder = UpSampling1D(4)(decoder)
decoder = Conv1D(4, 12, activation = 'relu', padding = 'same')(decoder)


## closed as off-topic by Firebug, Siong Thye Goh, Bernhard, Jeremy Miles, Frans RodenburgOct 24 at 5:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Firebug, Siong Thye Goh, Bernhard, Jeremy Miles, Frans Rodenburg
If this question can be reworded to fit the rules in the help center, please edit the question.

Conv1D has a parameter called data_format which by default is set to "channels_last". So, by default it expects inputs to be of the form (batch_size,steps,channels). To quote from the Documentation:
Concretely, in your network you have inputs of shape (100,4). You apply 50 1DConv filters of shape (12,4) (12 shared weights per channels) to get the output of dimension (batch_size,100,50) (50 channels each of length 100). You then apply MaxPooling1D with pool_size=4 and stride=4 with padding="same" i.e. padding=0 so your final latent feature has dimension (25,50). The convolution that follows does not change the shape. The UpSampling1D will then change the shape to (100,50) and the final convolution converts the input back to shape (100,4). So is this correct? If you are just worried about whether you got the syntax for incorporating the channels correctly then yes, you did get it right. That is how it's done.