title: Training and Loss not changing in Keras CNN model
body: <p>I am running a CNN for left and right shoeprint classfication. I have 190,000 training images and I use 10% of it for validation. My model is setup as shown below. I get the paths of all the images, read them in and resize them. I normalize the image, and then fit it to the model. My issue is that I have stuck at a training accuracy of 62.5% and a loss of around 0.6615-0.6619. Is there something wrong that I am doing? How can I stop this from happening?</p>
  <p>Just some interesting points to note:</p>
  <ol>
  <li><p>I first tested this on 10 images I was having the same issue but changing the optimizer to adam and batch size to 4 worked.</p>
  </li>
  <li><p>I then tested on more and more images, but each time I would need to change the batch size to get improvements in the accuracy and loss. With 10,000 images I had to use a batch size of 500 and optimizer rmsprop. However, the accuracy and loss only really began to change after epoch 10.</p>
  </li>
  <li><p>I am now training on 190,000 images and I cannot increase the batch size as my GPU is at is max.</p>
  </li>
  </ol>
  <pre class="lang-py prettyprint-override"><code>    imageWidth = 50
      imageHeight = 150
      
      def get_filepaths(directory):
          file_paths = []
          for filename in files:
              filepath = os.path.join(root, filename)
              file_paths.append(filepath) # Add it to the list.
          return file_paths
      
      def cleanUpPaths(fullFilePaths):
          cleanPaths = []
          for f in fullFilePaths:
              if f.endswith(&quot;.png&quot;):
                  cleanPaths.append(f)
          return cleanPaths
      
      def getTrainData(paths):
          trainData = []
          for i in xrange(1,190000,2):
              im = image.imread(paths[i])
              im = image.imresize(im, (150,50))
              im = (im-255)/float(255)
              trainData.append(im)
          trainData = np.asarray(trainData)
          right = np.zeros(47500)
          left = np.ones(47500)
          trainLabels = np.concatenate((left, right))
          trainLabels = np_utils.to_categorical(trainLabels)
          return (trainData, trainLabels)
  
      #create the convnet
      model = Sequential()
      
      model.add(Conv2D(32, (3, 3), activation='relu', input_shape=(imageWidth,imageHeight,1),strides=1))#32
      model.add(Conv2D(32, (3, 3), activation='relu'))
      model.add(MaxPooling2D(pool_size=(2, 2)))
      model.add(Dropout(0.25))
      
      model.add(Conv2D(64, (3, 3), activation='relu',strides=1))
      model.add(Conv2D(64, (3, 3), activation='relu'))
      model.add(MaxPooling2D(pool_size=(2, 2)))
      model.add(Dropout(0.25))
      
      model.add(Conv2D(64, (3, 3), activation='relu'))
      model.add(MaxPooling2D(pool_size=(1, 3)))
      model.add(Dropout(0.25))
      
      model.add(Conv2D(64, (1, 2), activation='relu'))
      model.add(MaxPooling2D(pool_size=(2, 1)))
      model.add(Dropout(0.25))
      
      model.add(Flatten())
      model.add(Dense(256, activation='relu'))
      model.add(Dropout(0.5))
      model.add(Dense(2, activation='softmax'))
      
      sgd = SGD(lr=0.01)
      model.compile(loss='categorical_crossentropy', optimizer='rmsprop',metrics=['accuracy'])
      
      #prepare the training data*/
      
      trainPaths = get_filepaths(&quot;better1/train&quot;)
      trainPaths = cleanUpPaths(trainPaths)
      (trainData, trainLabels) = getTrainData(trainPaths)
      trainData = np.reshape(trainData,(95000,imageWidth,imageHeight,1)).astype('float32')
      trainData = (trainData-255)/float(255)
      
      #train the convnet***
      model.fit(trainData, trainLabels, batch_size=500, epochs=50, validation_split=0.2)
      
      #/save the model and weights*/
      model.save('myConvnet_model5.h5');
      model.save_weights('myConvnet_weights5.h5');
  </code></pre>