0

I have implemented VGG-16 in tensorflow, VGG-16 is reasonably deep network, so the loss should definitely reduce. But in my code it's not reducing. But when i run the model on same batch again and again then the loss is reducing. Any idea, why such thing can happen.

VGG-net is followed from here.

Training was done on, dog-vs-cat dataset, with image size 224x224x3.

Network parameters are folloing:

lr_rate: 0.001 batch_size = 16

Find code @ GitHubGist

Output is as below:

Output

danishansari
  • 634
  • 5
  • 21
  • Whenever my NN aren't learning, I start with this [list](https://blog.slavv.com/37-reasons-why-your-neural-network-is-not-working-4020854bd607) and work through it. Also, your code is missing some indents. – Edgar H Mar 05 '19 at 09:49
  • @EdgarH Sorry, but indentation is wrong because StackOverflow won't support code section in one go. So I had put segments of code into the code section, I guess that ruined the indentation. – danishansari Mar 05 '19 at 15:53
  • you can put your code into gist(gist.github.com) and provide link here – Mirodil Mar 05 '19 at 16:21

1 Answers1

1

I am assuming you're following architecture variant E from the Simonyan & Zisserman paper you linked - then I found a few problems with your code:

  • Use activation='relu' for all hidden layers.

  • Max pooling should be done over a 2 x 2 window, so use pool_size=[2, 2] instead of pool_size=[3, 3] in the pooling layers.

  • Properly link up pool13 with conv13:

pool13 = tf.layers.max_pooling2d(conv13, [2, 2], 2, name='pool13')

I don't have any GPU available to test, but with sufficient iterations the loss should decrease.

prouast
  • 1,176
  • 1
  • 12
  • 17
  • thanks for your review, I modified that code as you suggested for the obvious mistakes I made, But this did not helped me, loss is still not reducing. – danishansari Mar 06 '19 at 06:52