TensorFlow 2冻结模型注意事项
冻结模型报错,可能是这个原因。
![TensorFlow 2冻结模型注意事项](/content/images/size/w1200/2021/07/ashley-winkler-WiLt6ScXLaE-unsplash--1-.jpg)
今天在尝试冻结一个TensorFlow模型时遇到错误:
ValueError: Input 0 of node embedding_model/resnet50v2/conv2_block1_preact_bn/AssignNewValue/AssignVariableOp was passed float from embedding_model/resnet50v2/conv2_block1_preact_bn/FusedBatchNormV3/ReadVariableOp/resource:0 incompatible with expected resource.
冻结模型的代码来自这里:
Save, Load and Inference From TensorFlow 2.x Frozen Graph
Hello Underworld.
![](https://leimao.github.io/favicon/apple-touch-icon.png)
模型本身是基于TensorFlow的 keras.app,所以模型出问题的可能性很小。多番尝试之后终于找到了问题所在。