Maybe I\'m making predictions wrong?
Here\'s the project... I have a greyscale input image that I am trying to segment. The segmentation is a simple binary classific
There are multiple errors in your code:
WARNING: This op expects unscaled logits, since it performs a softmax on logits internally for efficiency. Do not call this op with the output of softmax, as it will produce incorrect results.
in fact since you have 2 classes, you should use a loss with softmax, using tf.nn.softmax_cross_entropy_with_logits
When using tf.argmax(pred, 1)
, you only apply argmax over axis 1, which is the height of the output image. You should use tf.argmax(pred, 3)
on the last axis (of size 2).
The biggest drawback is that your model in general will be very hard to optimize.
I recommend reading a bit about semantic segmentation first:
If you want to work with TensorFlow, you will need to start small. First try a very simple network with maybe 1 hidden layer.
You need to plot all the shapes of your tensors to make sure they correspond to what you thought. For instance, if you had plotted tf.argmax(y, 1)
, you would have realized the shape is [batch_size, 200, 2]
instead of the expected [batch_size, 200, 200]
.
TensorBoard is your friend, you should try to plot the input image here, as well as your predictions to see what they look like.
Try small, with a very small dataset of 10 images and see if you can overfit it and predict almost the exact response.
To conclude, I am not sure of all my suggestions but they are worth trying, and I hope this will help you on the path to success !