值我是新的tensorflow 我尝试导入SVHN数据集code that represented in this CNN tutorial的代码读取cifar10数据集作为二进制和我想SVHN数据集作为png图片来代替它参数tensorflow
我改变了层和读取的数据步骤。此外,我调整所有的输入图像他们阅读后[32,32]
= batch_size时128
的问题是,当我试着训练它,它给了我一个错误输入数据的步骤::
子码以下所示的:::
label_bytes = 1 # 2 for CIFAR-100
result.height = 32
result.width = 32
result.depth = 3
image_bytes = result.height * result.width * result.depth
# Every record consists of a label followed by the image, with a
# fixed number of bytes for each.
record_bytes = label_bytes + image_bytes
# Read a record, getting filenames from the filename_queue. No
# header or footer in the CIFAR-10 format, so we leave header_bytes
# and footer_bytes at their default of 0.
reader = tf.WholeFileReader()
#for binar format (cifar daatset)
###reader = tf.FixedLengthRecordReader(record_bytes=record_bytes) ##using for binary (.bin) format
###reader = tf.TextLineReader() #this for scv formate and I used for .mat format
result.key, value = reader.read(filename_queue)
# Convert from a string to a vector of uint8 that is record_bytes long.
###record_bytes = tf.decode_raw(value, tf.uint8) ## for .bin formate
record_bytes = tf.image.decode_png(value)
result.uint8image = record_bytes
result.uint8image = tf.image.resize_images(result.uint8image, [32,32])
# The first bytes represent the label, which we convert from uint8->int32.
result.label = tf.cast(
tf.strided_slice(record_bytes, [0], [label_bytes]), tf.int32)
# The remaining bytes after the label represent the image, which we reshape
# from [depth * height * width] to [depth, height, width].
depth_major = tf.reshape(
tf.strided_slice(record_bytes, [label_bytes],
[label_bytes + image_bytes]),
[result.depth, result.height, result.width])
# Convert from [depth, height, width] to [height, width, depth].
result.uint8image = tf.transpose(depth_major, [1, 2, 0])
显示错误波纹管太::
文件“ /home/Desktop/SVHN/cifar10_input.py”,线111,在read_cifar10 [result.depth,result.height,result.width])
InvalidArgumentError(参见上述用于回溯):输入重塑是一个张量与44856点的数值,但被请求的形状有3072
我有两个问题::
1)我想这个错误的解释,因为我不明白,我怎么能解决这个问题。
2)有没有什么好的教程,解释了良好的CNN参数如何选择价值