tensorflow error:Unimplemented: Cast string to uint8 is not supported -
sorry poor english.first. i'm reading mnist tutorials,and try code functions encode images tfrecord , read data tfrecord files. , there errors. tf version 0.11 enter image description here i'm not sure whether there wrong in encoding or decoding process. compared codes tutorials code, no mistake can find. suspect no record read reader.read(), how can exam assumption?
img=image.open(img_path) img=img.resize((rows,cols)) img_raw=img.tobytes() example=tf.train.example(features=tf.train.features(feature={ 'image_raw':_byte_feature(img_raw), 'label':_int64_feature(int(i))}))
decoding process
reader=tf.tfrecordreader() _,example=reader.read(filequeue) features=tf.parse_single_example(example,features={'image_raw': tf.fixedlenfeature([],tf.string), 'label':tf.fixedlenfeature([],tf.int64)}) image=tf.decode_raw(features['image_raw'],tf.uint8) image.set_shape(rows*cols) image=tf.cast(image,tf.float32)*(1./255)-0.5 label=tf.cast(features['label'],tf.int32)
Comments
Post a Comment