<p>This is very much expected. <strong>This problem is called over-fitting</strong>. This is when your model starts "memorizing" the training examples without actually learning anything useful for the Test set. In fact, this is exactly why we use a test set in the first place. Since if we have a complex enough model we can always fit the data perfectly, even if not meaningfully. The test set is what tells us what the model has actually learned.  </p>

<p>Its also useful to use a <strong>Validation set</strong> which is like a test set, but you use it to find out when to stop training. When the Validation error stops lowering you stop training.  <strong>why not use the test set for this?</strong> The test set is to know how well your model would do in the real world. If you start using information from the test set to choose things about your training process, than its like your cheating and you will be punished by your test error no longer representing your real world error.</p>

<p>Lastly, <strong>convolutional neural networks are notorious for their ability to over-fit</strong>. It has been shown the  Conv-nets can get zero training error even if you shuffle the labels and even <em>random pixels</em>. That means that there doesn't have to be a real pattern for the Conv-net to learn to represent it. This means that <strong>you have to regularize a conv-net</strong>. That is, you have to use things like <strong>Dropout</strong>, <strong>batch normalization</strong>, <strong>early stopping</strong>.</p>

<p>I'll leave a few links if you want to read more:</p>

<p>Over-fitting, validation, early stopping
<a href="https://elitedatascience.com/overfitting-in-machine-learning" rel="nofollow noreferrer">https://elitedatascience.com/overfitting-in-machine-learning</a></p>

<p>Conv-nets fitting random labels:
<a href="https://arxiv.org/pdf/1611.03530.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1611.03530.pdf</a>
(this paper is a bit advanced, but its interresting to skim through)</p>

<p>P.S. to actually improve your test accuracy you will need to change your model or train with data augmentation. You might want to try transfer learning as well.</p>
Training accuracy increases aggresively, test accuracy settles
<p>While training a convolutional neural network following <a href="https://arxiv.org/pdf/1412.6622.pdf" rel="nofollow noreferrer">this</a> article, the accuracy of the training set increases too much while the accuracy on the test set settles. </p>

<p>Below is an example with 6400 training examples, <strong>randomly chosen at each epoch</strong> (so some examples might be seen at the previous epochs, some might be new), and 6400 <strong>same test examples</strong>.</p>

<p>For a bigger data set (64000 or 100000 training examples), the increase in training accuracy is even more abrupt, going to 98 on the third epoch.</p>

<p>I also tried using <strong>the same 6400 training examples</strong> each epoch, just randomly shuffled. As expected, the result is worse.</p>

<pre><code>epoch 3  loss 0.54871 acc 79.01 
learning rate 0.1
nr_test_examples 6400    
TEST epoch 3  loss 0.60812 acc 68.48 
nr_training_examples 6400
tb 91
epoch 4  loss 0.51283 acc 83.52 
learning rate 0.1
nr_test_examples 6400
TEST epoch 4  loss 0.60494 acc 68.68 
nr_training_examples 6400
tb 91
epoch 5  loss 0.47531 acc 86.91 
learning rate 0.05
nr_test_examples 6400
TEST epoch 5  loss 0.59846 acc 68.98 
nr_training_examples 6400
tb 91
epoch 6  loss 0.42325 acc 92.17 
learning rate 0.05
nr_test_examples 6400
TEST epoch 6  loss 0.60667 acc 68.10 
nr_training_examples 6400
tb 91
epoch 7  loss 0.38460 acc 95.84 
learning rate 0.05
nr_test_examples 6400
TEST epoch 7  loss 0.59695 acc 69.92 
nr_training_examples 6400
tb 91
epoch 8  loss 0.35238 acc 97.58 
learning rate 0.05
nr_test_examples 6400
TEST epoch 8  loss 0.60952 acc 68.21
</code></pre>

<p>This is my model (I'm using RELU activation after each convolution):</p>

<pre><code>conv 5x5 (1, 64)
max-pooling 2x2
dropout
conv 3x3 (64, 128)
max-pooling 2x2
dropout
conv 3x3 (128, 256)
max-pooling 2x2
dropout
conv 3x3 (256, 128)
dropout
fully_connected(18*18*128, 128)
dropout
output(128, 128)
</code></pre>

<p><strong>What could be the cause?</strong></p>

<p>I'm using Momentum Optimizer with learning rate decay:</p>

<pre><code>    batch = tf.Variable(0, trainable=False)

    train_size = 6400

    learning_rate = tf.train.exponential_decay(
      0.1,                # Base learning rate.
      batch * batch_size,  # Current index into the dataset.
      train_size*5,          # Decay step.
      0.5,                # Decay rate.
      staircase=True)
    # Use simple momentum for the optimization.
    optimizer = tf.train.MomentumOptimizer(learning_rate,
                                         0.9).minimize(cost, global_step=batch)
</code></pre>