title: Audio processing Conv1D keras
body: <p>I am learning Keras using audio classification, Actually, I am implementing the code with modification from <a href="https://github.com/deepsound-project/genre-recognition/blob/master/train_model.py" rel="nofollow noreferrer">https://github.com/deepsound-project/genre-recognition/blob/master/train_model.py</a> using Keras.</p>
  
  <p>The shape of the dataset is </p>
  
  <pre><code>X_train shape = (800, 32, 1)
  y_train shape = (800, 10)
  X_test shape = (200, 32, 1)
  y_test shape = (200, 10)
  </code></pre>
  
  <p>The model </p>
  
  <pre><code>model = Sequential()
  
  model.add(Conv1D(filters=256, kernel_size=5, input_shape=(32,1),     activation="relu"))
  model.add(BatchNormalization(momentum=0.9))
  model.add(MaxPooling1D(2))
  model.add(Dropout(0.5))
  model.add(Conv1D(filters=256, kernel_size=5, activation="relu"))
  model.add(BatchNormalization(momentum=0.9))
  model.add(MaxPooling1D(2))
  model.add(Dropout(0.5))
  
  model.add(Flatten())
  model.add(Dense(128, activation="relu", ))
  model.add(Dense(10, activation='softmax'))
  
  model.compile(
      loss='categorical_crossentropy',
      optimizer = Adam(lr=0.001),
      metrics = ['accuracy'],
  )
  model.summary()
  
  red_lr= ReduceLROnPlateau(monitor='val_loss',patience=2,verbose=2,factor=0.5,min_delta=0.01)
  check=ModelCheckpoint(filepath=r'/content/drive/My Drive/Colab Notebooks/gen/cnn.hdf5', verbose=1, save_best_only = True)
  
  History = model.fit(X_train,
                  y_train,
                  epochs=100,
                  #batch_size=512,
                  validation_data = (X_test, y_test),
                  verbose = 2,
                  callbacks=[check, red_lr],
                  shuffle=True )
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/RmyCp.png" rel="nofollow noreferrer">The accuracy graph</a></p>
  
  <p><a href="https://i.stack.imgur.com/trlXc.png" rel="nofollow noreferrer">Loss graph</a></p>
  
  <p>I do not understand, Why the val_acc is in the range of 70%. I tried to modify the model architecture including optimizer, but no improvement.</p>
  
  <p>And, Is it good to have a lot of difference between loss and val_loss.</p>
  
  <p>how to improve the accuracy above 80... any help...</p>
  
  <p>Thank you</p>