machrisaa / tensorflow-vgg

VGG19 and VGG16 on Tensorflow
2.21k stars 1.08k forks source link

Training does not work #33

Closed martin3000 closed 7 years ago

martin3000 commented 7 years ago

I use test_vgg19_trainable to train the vgg19 net. I feed a photo of a face (not tiger), telling the net it is a tiger (#292=1). But in every run the system says it is a "cup" (#968) with p=1.

machrisaa commented 7 years ago

Hi @martin3000, it depends on how you train the network. Do you mind to let me have a look at your script that trains the network?

martin3000 commented 7 years ago

Of course...have a look. I forgot to normalize the image: img1 = img1 / 255.0. I changed the cost function and now training works:

    cross_entropy  = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels=true_out, logits=vgg.prob))
    train = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)

temp.txt