【发布时间】:2020-02-28 17:37:47
【问题描述】:
假设我有一个 CNN 模型,它以类似 Unet 的方式输出 N 个概率图作为与输入图像相同大小的掩码。然后,我想在每个掩码上应用最小二乘拟合,以获取函数的系数作为输出,并使用这些系数来计算我的模型损失。
def unet_model(...)
# init unet model
...
...
# final layer
mask_out = layers.Conv2D(output_channels, (1,1), activation='softmax')(conv9)
# start applying e.g least squares fit here
eq_list = tf.Variable((x_map, y_map, mask_out))
transp = tf.transpose(a)
...
当我初始化模型时,transp 会得到以下错误。我已经在别处测试了最小二乘拟合操作。
FailedPreconditionError: Error while reading resource variable _AnonymousVar1423 from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/_AnonymousVar1423/N10tensorflow3VarE does not exist. name: transpose/
我有一些假设,例如转置无法处理批量大小的占位符轴,但通常对此一无所知。
【问题讨论】:
标签: python tensorflow keras