jakeret / tf_unet

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

Binary classification not working on custom dataset #170

Open 314rated opened 6 years ago

314rated commented 6 years ago

Hi, I am trying to do binary segmentation on 128x128 images. Padding is done on them to ensure outputed image is also 128x128 (as per your kind suggestion). The number of classes = 2 (one is background, other is object). However, the U-net is giving total white output in the entire image. It is not separating between object and background. I have tried both the losses as provided by Unet, changed the number of layers, and feature roots. Could you please suggest any other steps that can be taken to remedy this? Thanks

femonk commented 6 years ago

Hi, have you already checked your images? I had a similar issue (I was also working on a 2-class problem) 'cause the image values were 0 for 'class 1' and 255 for the second one instead of 0 and 1.

314rated commented 6 years ago

The real images are colored images (128x128x3). The masked images are (128x128x1), but not 0-1 valued. I modified ImageDataProvider._load_file to make masked image to 0/1 array. It still gives same results. Anyhow, the mask is being read in boolean, so it should not matter, right?