tensorflow 批量归一化冻结

tensorflow batch normalization freeze

我正在尝试在 unity 上实现冻结图。但是我有一些错误。我认为错误与批量归一化有关,但我不知道如何解决这个问题。
当我训练我的模型时,BN 是必需的,所以我不能只删除 BN

所以我必须找到一些方法来使用 BN 正确地冻结图表,而不会在统一实施时导致错误。有什么想法吗?

我已经对这个问题进行了一些研究,我知道不仅 BN 导致了这个错误,dropout 也有同样的问题。

注意:我使用的是 tensorflowsharp。网络基于 ResNet34,稍作修改。

error: TFException: Input 0 of node bn2c_branch2a/Assign was passed float from bn2c_branch2a/mean:0 incompatible with expected float_ref.
TensorFlow.TFStatus.CheckMaybeRaise (TensorFlow.TFStatus incomingStatus, System.Boolean last) (at <013bee3700ac45f2a3b8843fa1d4d914>:0)
TensorFlow.TFGraph.Import (TensorFlow.TFBuffer graphDef, TensorFlow.TFImportGraphDefOptions options, TensorFlow.TFStatus status) (at <013bee3700ac45f2a3b8843fa1d4d914>:0)
TensorFlow.TFGraph.Import (System.Byte[] buffer, TensorFlow.TFImportGraphDefOptions options, TensorFlow.TFStatus status) (at <013bee3700ac45f2a3b8843fa1d4d914>:0)
TensorFlow.TFGraph.Import (System.Byte[] buffer, System.String prefix, TensorFlow.TFStatus status) (at <013bee3700ac45f2a3b8843fa1d4d914>:0)
DeepGes.GClassifier.InitClassifier () (at Assets/Scripts/Gesture_Main/GClassifier.cs:42)
G_Game.Awake () (at Assets/Scripts/Gesture_Main/G_Game.cs:67)

我不太确定你在问什么或在做什么,但是我为你做了一些研究,希望能为你指明正确的方向。

Good Audience - TensorFlow + Unity: How to set up a custom TensorFlow graph in Unity

这里有一个人是 ML 工程师,所以不妨问问他。
Unity Forums - Using Tensorflow's inference graph in Unity

祝你好运。