相关疑难解决方法(0)

reshape 的输入是一个有 37632 个值的张量,但请求的形状有 150528

我有同样的问题:重塑的输入是一个具有 37632 个值的张量,但请求的形状有 150528 个。

 writer = tf.python_io.TFRecordWriter("/home/henson/Desktop/vgg/test.tfrecords")  # ??????

for index, name in enumerate(classes):
    class_path = cwd + name +'/'
    for img_name in os.listdir(class_path):
        img_path = class_path + img_name  # ????????
    img = Image.open(img_path)
    img = img.resize((224, 224))
    img_raw = img.tobytes()  # ???????????
    example = tf.train.Example(features=tf.train.Features(feature={
        "label": tf.train.Feature(int64_list=tf.train.Int64List(value=[index])),
        'img_raw': tf.train.Feature(bytes_list=tf.train.BytesList(value=[img_raw]))
    }))  # example???label?image??????
    writer.write(example.SerializeToString())  # ???????

writer.close()


def read_and_decode(filename):  # ??dog_train.tfrecords
    filename_queue = tf.train.string_input_producer([filename])  # ????queue??

reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)  # ????????
features = tf.parse_single_example(serialized_example,
                                   features={ …
Run Code Online (Sandbox Code Playgroud)

python reshape tensorflow

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

python ×1

reshape ×1

tensorflow ×1