Image Segmentation with TensorFlow

J_K picture J_K · Apr 4, 2016 · Viewed 10.6k times · Source

I am trying to see the feasibility of using TensorFlow to identify features in my image data. I have 50x50px grayscale images of nuclei that I would like to have segmented- the desired output would be either a 0 or 1 for each pixel. 0 for the background, 1 as the nucleus.

Example input: raw input data

Example label (what the "label"/real answer would be): output data (label)

Is it even possible to use TensorFlow to perform this type of machine learning on my dataset? I could potentially have thousands of images for the training set.

A lot of the examples have a label correspond to a single category, for example, a 10 number array [0,0,0,0,0,0,0,0,0,0,0] for the handwritten digit data set, but I haven't seen many examples that would output a larger array. I would assume I the label would be a 50x50 array?

Also, any ideas on the processing CPU time for this time of analysis?

Answer

rafaelcosman picture rafaelcosman · Apr 4, 2016

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.