gpt4 book ai didi

tensorflow - Keras/Tensorflow : "You must feed a value for placeholder tensor ' input_ 1' with dtype float and shape [?, 600, 451, 3]"

转载 作者:行者123 更新时间:2023-12-03 16:39:17 27 4
gpt4 key购买 nike

我有这个 CNN 我正在工作。
输入形状是动态的,但我将其固定为 [?, 600, 451, 3] (batch_size, height, width, channels) 以便我可以调试它。
我有一个 随机批量生成器 我创建:

test = random_batch_generator(z_train
, num_processes=12
, num_batch=steps_train
, preloaded_batch=100
, batch_size=batch_size
, chunk_size=batch_size
, dataaugmfunc=heavy_dataaugm
, seq=seq
, initial_dim=initial_dim
, min_overlap=MINOVERLAP
)
当我做:
next(test)[0].shape
或者
next(test)[0].dtype
它向我输出正确的形状 ([?, 600, 451, 3]) 和 dtype (float32),这在理论上是我输入所需的。我也查了批次的内容,好像不错。
尽管如此,当我使用以下内容训练我的模型时,我得到了:
model.fit_generator(
random_batch_generator(z_train (...)),
validation_data= (x_val_mem,y_val_mem),
steps_per_epoch=steps_train,
validation_steps=steps_val,
epochs=epochs
,callbacks=model_callbacks(modelname)
,class_weight = [0.005,0.995]
)
此错误消息:

InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,600,451,3]

[[Node: input_1 = Placeholderdtype=DT_FLOAT, shape=[?,600,451,3], _device="/job:localhost/replica:0/task:0/device:GPU:0"]]


我究竟做错了什么?感谢一千人对此的任何帮助或直觉。

最佳答案

你在使用 TensorBoard 回调吗?如果是这样,您可以尝试在创建模型之前添加它

import keras.backend as K
K.clear_session()

this answer

关于tensorflow - Keras/Tensorflow : "You must feed a value for placeholder tensor ' input_ 1' with dtype float and shape [?, 600, 451, 3]",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51483450/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com