jakeret / tf_unet

Generic U-Net Tensorflow implementation for image segmentation
GNU General Public License v3.0
1.9k stars 748 forks source link

2 class segmentation prediction values don't range from [0, 1] #286

Open ellenemerson opened 4 years ago

ellenemerson commented 4 years ago

Hello,

I am working on a 2 class grayscale image segmentation problem. I am using the ImageDataProvider to load the input and labels, and everything seems to work fine with that as far as I can tell. The problem is that the prediction values for one class always range from [0, 0.5], and the values for the other class range from [0.5, 1]. From my understanding, they should range from [0, 1].

For example, say I run predict() and it gives me an array of shape (1, 256, 256, 2). Following the toy_problem, if I do: class_0 = prediction[0,...,0] class_1 = prediction[0,...,1] class_0 values will range from [0.5, 1] and class_1 values will range from [0, 0.5]. From experimenting with the toy_problem it seems like both should range from [0, 1].

Anyone have any ideas what might be causing this?

Thanks in advance for your suggestions.

ellenemerson commented 4 years ago

Is it possible that the probability space is stratified by the number of classes? And that you have to divide the probability value from prediction[0,...,1] by the value from prediction[0,...,0] to get the true probability value?

The number ranges I am seeing would make logical sense for this, and I tried this and got somewhat reasonable results, but I can't find any documentation of this anywhere.