I want the image file extension to call a different image decoder, and I found the tf.string_split function in tensorflow r0.11 there.
filename_queue = tf.train.string_input_producer(filenames, shuffle=shuffle)
reader = tf.WholeFileReader()
img_src, img_bytes = reader.read(filename_queue)
split_result = tf.string_split(img_src, '.')
But when I run it, I get this error:
ValueError: Shape must be rank 1 but is rank 0 for 'StringSplit' (op: 'StringSplit') with input shapes: [], [].
I think this may be caused by the output of the form img_src. I am trying to use img_src.set_shape([1,])to fix it, but it doesn't seem to work, I get this error:
ValueError: Shapes () and (1,) are not compatible
Also, I cannot get the form img_srcusing
tf.Print(split_result, [tf.shape(img_src)],'img_src shape=')
Result img_src shape=[]. But if I use the following code:
tf.Print(split_result, [img_src],'img_src=')
Result img_src=test_img/test1.png. Am I doing something wrong?
source
share