Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image preprocessing is INCONSISTENT at train and evaluate stage causes InvalidArgumentError #38

Open
ytliang97 opened this issue Mar 6, 2020 · 0 comments

Comments

@ytliang97
Copy link

ytliang97 commented Mar 6, 2020

Hi, first thanks for getting this done.

Recently I encountered following problem when I try to run evaluate.py:


tensorflow.python.framework.errors_impl.InvalidArgumentError: Number of ways to split should evenly divide the split dimension, but got split_dim 2 (size = 1) and num_split 3



I've noticed that the preprocessing codes in train.py use tf.reshape()before decoding images :
use tf.reshape() can convert image from grayscale to rgb.

image = tf.image.decode_image(
tf.reshape(parsed['image/encoded'], shape=[]), _DEPTH)

label = tf.image.decode_image(
tf.reshape(parsed['label/encoded'], shape=[]), 1)



but in evaluate.py, the preprocessing codes didn't use tf.reshape() :

image = tf.image.decode_image(image_string)

label = tf.image.decode_image(label_string)



This will raise error if there is a grayscale image in dataset. So I edit code like this:

image = tf.image.decode_image( tf.reshape(image_string, shape=[]), 3 )

label = tf.image.decode_image( tf.reshape(label_string, shape=[]), 1 )

It works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant