我试图看到使用TensorFlow识别图像数据中的功能的可行性。我有50x50像素的原子核灰度图像,我希望对其进行分割 - 对于每个像素,所需的输出为0或1。 0为背景,1为核。
示例输入:raw input data
示例标签("标签" /真实答案是什么):output data (label)
是否可以使用TensorFlow在我的数据集上执行此类机器学习?我可能有数千张训练集的图像。
很多例子都有一个标签对应一个类别,例如,一个10号数组[0,0,0,0,0,0,0,0,0,0,0]用于手写数字数据集,但我还没有看到很多可以输出更大数组的例子。我想我的标签是50x50阵列?
此外,对于此次分析处理CPU时间的任何想法?
答案 0 :(得分:1)
Yes, this is possible with TensorFlow. In fact, there are many ways to approach it. Here's a very simple one:
Consider this to be a binary classification task. Each pixel needs to be classified as foreground or background. Choose a set of features by which each pixel will be classified. These features could be local features (such as a patch around the pixel in question) or global features (such as the pixel's location in the image). Or a combination of the two.
Then train a model of your choosing (such as a NN) on this dataset. Of course your results will be highly dependant upon your choice of features.
You could also take a graph-cut approach if you can represent that computation as a computational graph using the primitives that TensorFlow provides. You could then either not make use of TensorFlow's optimization functions such as backprop or if there are some differentiable variables in your computation you could use TF's optimization functions to optimize those variables.
答案 1 :(得分:1)
SoftmaxWithLoss()适用于您的图像分割问题,如果您将预测标签和真实标签贴图从[批次,高度,宽度,通道]重新整形为[N,通道]。
在你的情况下,你的最终预测地图将是channel = 2,并且在重新整形后,N =批次高度宽度,那么你可以在tensorflow中使用SoftmaxWithLoss()或类似的损失函数来运行优化。
请参阅可能有所帮助的this question。
答案 2 :(得分:0)
尝试对模型使用卷积滤镜。卷积和下采样层的堆叠。输入应该是标准化的像素图像,输出应该是掩码。最后一层应该是softmaxWithLoss。 HTH。