从检查点加载TensorFlow模型并更改最后一层,E

2024-06-28 19:41:01 发布

您现在位置:Python中文网/ 问答频道 /正文

现在把输出从一级到二级的输出都改为两级。在

不幸的是,我得到了这个错误:

INFO:tensorflow:Error reported to Coordinator: , Assign requires shapes of both tensors to match. lhs shape= [50,1] rhs shape= [50,2] [[Node: save/Assign_11 = Assign[T=DT_FLOAT, _class=["loc:@Regress/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Regress/weights/Adam_1, save/RestoreV2_11)]]

我的最后一层有50个节点。在

我还排除了恢复时的最后一层。在

有人知道这里发生了什么吗?

我正在使用train_image_classifier.py,我已经更改了最后一层以满足我的需要。在


Tags: toinfotruedevicesavetensorflow错误error
1条回答
网友
1楼 · 发布于 2024-06-28 19:41:01

解决了。在

我不得不删除其中的checkpoint文件型号.ckpt文件夹。在

下一次我想在更改架构后使用TensorFlow进行转移学习的检查表:

  • 使用inspect_checkpoint.py验证型号.ckpt文件存储了正确的变量。在
  • 一定要读对了型号.ckpt文件。在
  • 请确保在还原时排除了正确的作用域。在
  • 如有必要,删除checkpoint。在

相关问题 更多 >