Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about 'softmax' in train_vgg.py #4

Open
Vincentyao1995 opened this issue Mar 26, 2019 · 2 comments
Open

question about 'softmax' in train_vgg.py #4

Vincentyao1995 opened this issue Mar 26, 2019 · 2 comments

Comments

@Vincentyao1995
Copy link

Vincentyao1995 commented Mar 26, 2019

Hello there!

Your code is pretty clear and helpful to others, thank you for your effort!

Here, I raised a question about 'softmax', u write about this:

train_vgg.py:

#fc8
    with tf.name_scope('fc8') as scope:
        kernel = weight_variable([4096, 2])
        biases = bias_variable([2])
        output_fc8 = tf.nn.relu(fc(output_fc7, kernel, biases), name=scope)

    finaloutput = tf.nn.softmax(output_fc8, name="softmax")

    cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=finaloutput, labels=y))

Here, u used tf.nn.softmax_cross_entropy_with_logits() function, which I thought is inner implemented softmax to normalize data and then calcuate cross entropy, applied on finaloutput which has already been applied by 'softmax'. So is there more reasonable to use:

cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=output_fc8, labels=y))

?

That's to say, use output_fc8 result to calculate cross entropy.

@DirtoryYang
Copy link

yes.thanks, It`s so good!

@wy9933
Copy link

wy9933 commented Nov 19, 2020

Thanks, I have the same question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants