0
$\begingroup$

I'm working through the python API tutorials for Tensorflow and I'm seeing the results that are normally displayed, but it's always giving me the top five results.

I'm trying to discern all possibilities within a certain list of basic attributes, like if I'm given a picture of a forest, I want to ask tensorflow if the picture contains oak trees, pine trees, bushes, rivers, etc. I don't need to know if the image is a picture of a forest. Is this possible?

I'm not saying give me results it hasn't been trained to see, I'm saying I'm going to train the model with different types of trees/bushes/etc and I want to know if the given image contains any of those attributes (or the probability it thinks of for a given attribute).

$\endgroup$
2
  • 1
    $\begingroup$ Just take all results that gave larger than some probability p that you pick. $\endgroup$
    – kbrose
    Jul 23, 2018 at 21:02
  • 1
    $\begingroup$ If you look at VGG16, headless, the input is something like 25k elements. Those hold the information, but it is overwhelming. The average max number of good relationships a human can have is about 200. We are social creatures, and effective connection is literally key to our existence and preeminence on the planet. There is zero chance of having good understanding of 25k elements. It overwhelms the processing capacity of the brain. You have to pick something... $\endgroup$ Aug 18, 2020 at 15:19

1 Answer 1

1
$\begingroup$

Sounds like you want to see the predicted probabilities of a softmax function. You can assign the values to a list during training so you can see probabilities of each epoch if you'd like. As is written below, in_top_k will select the single top prediction of the softmax cross entropy function but if you have multiple targets in each picture you will want to change that "1" to the desired amount.

xentropy = tf.nn.sparse_softmax_cross_entropy_with_logits(logits = logits, 
           labels = y)

logit = tf.nn.in_top_k(logits, y, 1)

y_one_prob = tf.sigmoid(logit)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.