I want to get pixel matrix of objects within a image when the image is classified by Tensorflow (classify_image.py).
In other words, the recognized objects must be segmented first. E.g. there is a computer in the picture, i want to get all pixels which belong to the computer.
But till now i cannot find a sample from Tensorflow's tutorial.
The only things i can get is the recognition results through sample code of Tensorflow.
e.g.
softmax_tensor = sess.graph.get_tensor_by_name('softmax:0')
predictions = sess.run(softmax_tensor,
{'DecodeJpeg/contents:0': image_data})
predictions = np.squeeze(predictions)
# Creates node ID --> English string lookup.
node_lookup = NodeLookup()
top_k = predictions.argsort()[-FLAGS.num_top_predictions:][::-1]
for node_id in top_k:
human_string = node_lookup.id_to_string(node_id)
score = predictions[node_id]
print('%s (score = %.5f)' % (human_string, score))
Does someone have an idea? Is this possible?