title: How to implement a 1D Convolutional Auto-encoder in Keras for vector data?
body: <p>My input vector to the auto-encoder is of size 128. I have 730 samples in total (730x128). I am trying to use a 1D CNN auto-encoder. I would like to use the hidden layer as my new lower dimensional representation later.
  My code right now runs, but my decoded output is not even close to the original input. 
  Here is the code:</p>
  
  
  
  <pre class="lang-python prettyprint-override"><code>input_sig = Input(batch_shape=(None,128,1))
  x = Conv1D(64,3, activation='relu', padding='valid')(input_sig)
  x1 = MaxPooling1D(2)(x)
  x2 = Conv1D(32,3, activation='relu', padding='valid')(x1)
  x3 = MaxPooling1D(2)(x2)
  flat = Flatten()(x3)
  encoded = Dense(32,activation = 'relu')(flat)
  
  print("shape of encoded {}".format(K.int_shape(flat)))
  
  x2_ = Conv1D(32, 3, activation='relu', padding='valid')(x3)
  x1_ = UpSampling1D(2)(x2_)
  x_ = Conv1D(64, 3, activation='relu', padding='valid')(x1_)
  upsamp = UpSampling1D(2)(x_)
  flat = Flatten()(upsamp)
  decoded = Dense(128,activation = 'relu')(flat)
  decoded = Reshape((128,1))(decoded)
  
  print("shape of decoded {}".format(K.int_shape(x1_)))
  
  autoencoder = Model(input_sig, decoded)
  autoencoder.compile(optimizer='adam', loss='mse', metrics=['accuracy'])
  </code></pre>
  
  <p>The input to the autoencoder is then --> (730,128,1)
  But when I plot the original signal against the decoded, they are very different!!
  Appreciate your help on this. </p>