zizhaozhang / unet-tensorflow-keras

A concise code for training and evaluating Unet using tensorflow+keras
MIT License
186 stars 72 forks source link

Image shape mismatch #8

Closed ishapuri closed 7 years ago

ishapuri commented 7 years ago

I am trying to input data into this U-Net and I keep getting the error:

Traceback (most recent call last): File "train.py", line 119, in loss, pred_logits = sess.run([cross_entropy_loss, pred], feed_dict=feed_dict) File "/Users/ishapuri/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 789, in run run_metadata_ptr) File "/Users/ishapuri/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 975, in _run % (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (1, 288, 432, 4) for Tensor u'unet/input_1:0', which has shape '(?, 256, 256, 3)'

My images are png files and have shape (288, 432, 3). How do I fix this? What is the exact shape you are looking for? And what is the 1st number in this shape dimension? (what is the significance of the spot that has a ? in it). Thanks!