title: Difficulty adapting Keras example to customer data
body: <p>I'm trying to run the following network with Keras, powered by a TensorFlow backend. It's an adaptation of the "VGG-like" convnet from <a href="http://keras.io/examples/" rel="nofollow">http://keras.io/examples/</a>: </p>
  
  <pre><code>import os 
  import sys
  import json
  import model_control 
  from numpy import loadtxt, asarray
  from pandas import read_csv
  from scipy.ndimage import imread
  from keras.models import Sequential
  from keras.layers import Dense, Dropout, Activation, Flatten
  from keras.layers import Convolution2D, MaxPooling2D
  from keras.optimizers import SGD
  
  Y_train = loadtxt(model_control.y_train_file, delimiter=',', dtype = int)
  
  train_files = os.listdir(model_control.train_img_path)
  train_files = ['%s/%s' % (model_control.train_img_path, x) for x in train_files if 'jpg' in x]
  X_train = asarray([imread(x) for x in train_files])
  
  X_train.shape #..(8144, 128, 256) (a numpy array of 8144 128x256 greyscale, i.e. single-channel, images)
  Y_train.shape #..(8144,) (A 1-d numpy array of integer class labels) 
  
  model = Sequential()
  
  model.add(Convolution2D(32, 5, 5, border_mode='valid', input_shape=(1, 128, 256)))
  model.add(Activation('relu'))
  model.add(Convolution2D(32, 5, 5))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.25))
  
  model.add(Convolution2D(64, 5, 5, border_mode='valid'))
  model.add(Activation('relu'))
  model.add(Convolution2D(64, 5, 5))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.25))
  
  model.add(Flatten())
  model.add(Dense(256))
  model.add(Activation('relu'))
  model.add(Dropout(0.5))
  
  model.add(Dense(10))
  model.add(Activation('softmax'))
  
  sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True)
  model.compile(loss='categorical_crossentropy', optimizer=sgd)
  
  model.fit(X_train, Y_train, batch_size=32, nb_epoch=1, verbose=1)
  </code></pre>
  
  <p>This produces the error: </p>
  
  <pre><code>ValueError: Cannot feed value of shape (32, 128, 256) for Tensor u'Placeholder_89:0', which has shape '(?, 1, 128, 256)'
  </code></pre>
  
  <p>I've checked out the following posts but haven't been able to solve this one yet. Any help would be appreciated, along with an explanation of what's going wrong.</p>
  
  <ul>
  https://groups.google.com/forum/#!topic/keras-users/Vb7MhSqne0Y
  http://stackoverflow.com/questions/33974231/tensorflow-error-using-my-own-data
  </ul>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Posted this question to the Keras issue board (<a href="https://github.com/fchollet/keras/issues/2092" rel="nofollow">https://github.com/fchollet/keras/issues/2092</a>). There are <a href="https://gist.github.com/aaronpolhamus/39c7a71151b8560d02dd" rel="nofollow">Gist</a> and <a href="https://github.com/fchollet/keras/files/190676/keras_ex_data.zip" rel="nofollow">sample data</a> links that will allow you to re-create the problem. </p>