jakeret / tf_unet

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

Error: logits and labels must be broadcastable: logits_size=[1447680,2] labels_size=[0,2] #215

Closed vi1729 closed 5 years ago

vi1729 commented 6 years ago

Hi Joel, I could execute tf_unet code, with my new set of Training images. Then I changed the Optimizer to Adam and Padding to 'SAME'. I was able to train the model successfully with layers = 5 and features =32. I was trying multiple hyper parameters. Though I didnt change my code since then, I'm getting below error. Kindly suggest:

InvalidArgumentError (see above for traceback): logits and labels must be broadcastable: logits_size=[1447680,2] labels_size=[0,2] [[Node: cost/softmax_cross_entropy_with_logits = SoftmaxCrossEntropyWithLogits[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](cost/softmax_cross_entropy_with_logits/Reshape, cost/softmax_cross_entropy_with_logits/Reshape_1)]]

I'm using Tensorflow-cpu (version = 1.10.0) and Keras (2.2.2) on Pycharm. Is it because I abruptly interrupted my kernel while the Model was being Trained?? I wanted to stop the process and restart with new parameters. Does it effect the Binaries? Is there any way to rectify it?

I'm new to Machine Learning and your suggestion would be of great help! Thank you, Vijaya

vi1729 commented 6 years ago

I got the above error when I changed to layers = 4 or features_root = 64

jakeret commented 6 years ago

Sorry for the late reply. Probably it's already to late. Anyhow, it shouldn't cause any problem if you stop the training process. What confuses me a bit is that the size of your label is 0. This might indicate that something is not quite right

vi1729 commented 6 years ago

Thank you Joel, I'm still working on this code and this issue is not resolved. I was caught up with other training in between. Yes Labels size is 0, when I use SAME padding. I have not changed code anywhere. My image is also not a square one. I could not find root cause till now. Any guidance in this regard will be greatly appreciated!