Closed bondruy closed 2 years ago
Hey, what you can do to generate log density maps is to first retrieve the output from the network and then convert it as follows:
import tensorflow as tf
graph_def = tf.GraphDef()
with tf.gfile.Open("model_salicon_gpu.pb", "rb") as file:
graph_def.ParseFromString(file.read())
input_plhd = tf.placeholder(tf.float32, (None, None, None, 3))
[predicted_maps] = tf.import_graph_def(graph_def,
input_map={"input": input_plhd},
return_elements=["output:0"])
sum_per_image = tf.reduce_sum(predicted_maps[0], keep_dims=True)
log_density_maps = tf.log(tf.divide(predicted_maps[0], sum_per_image) + 1e-8)
with tf.Session() as sess:
saliency = sess.run(log_density_maps, feed_dict={input_plhd: input_img})
You just need to download a pre-trained model from here and feed an input image of your choice.
Thank you very much
Thank you Sir for the wonderful code I have a question,when I test on MIT300, how do I get the the log density predictions of a probability model