使用Tensorflow对图像进行分类时如何获取已识别对象的像素矩阵?

时间:2016-10-19 17:04:04

标签: python tensorflow deep-learning object-recognition

当想要通过Tensorflow(classify_image.py)对图像进行分类时,我希望得到图像中对象的像素矩阵。

换句话说,必须首先分割已识别的对象。 例如。图片中有一台电脑,我想得到属于电脑的所有像素。

但到目前为止,我找不到Tensorflow教程的样本。

我唯一能得到的是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))

有人有想法吗?这可能吗?

1 个答案:

答案 0 :(得分:1)

以下是使用TensorFlow进行图像分割的模型的一些链接: