原因就是你的数据是串数据,但是你用FixedLenFeature读取,改函数有个参数是需要输入形状的。
'image/width':
tf.FixedLenFeature(shape=(), tf.int64, default_value=0),
- 比如这个,由于宽度是个常数,所以shape直接省略了,但是你的是[1,2,3,3]这种就不能省,要不你将shape填写上
'image/encoded':
tf.FixedLenFeature(shape=(512,512), tf.string, default_value=''),
要么你使用别的函数解析
features={ 'image/superpixel16/class/encoded':
tf.VarLenFeature(tf.int64),}
parsed_features = tf.parse_single_example(example_proto, features)
super_16 = parsed_features['image/superpixel16/class/encoded']
super_16 = tf.sparse_tensor_to_dense(super_16)
此处使用非定长的解析,解析过后需要使用 tf.sparse_tensor_to_dense压缩一下,就能得到你的[1.2.3.3]了
参考