1
votes

I am using a CNN (U-Net) in Keras to segment an 8 bit image to get a binary mask. Despite reaching an accuracy of 0.9999 I still get a few values that are between 0 and 255 but would like to completely remove these values to have only 0 or 255. I have so far been using the binary cross entropy loss function, combined with a sigmoid activation function the last convolutional layer. Can someone tell me if there are other loss functions that could possibly solve this problem.

2
Can you explain you're net a bit more? What is the shape of your output? What are your labels? Do you have labels for your binary mask, whichs eems to be not your current output?dennis-w

2 Answers

1
votes

its better to use values between 0 - 1 .

its much harder do the NN to get good result at 0-255 , this way the binary cross entropy will work much better

0
votes

You can threshold to get only the two values you want. E.g:

y = model.predict(input_image) # your result image
y = 255 * (y > 128)