我有以下文件:1。retrained_graph.pb 2. retrained_labels.txt 3. _retrain_checkpoint.meta 4. _retrain_checkpoint.index 5. _retrain_checkpoint.data-00000-of-00001 6. checkpoint
执行命令:
python freeze_graph.py
--input_graph=/Users/saurav/Desktop/example/tmp/retrained_graph.pb
--input_checkpoint=./_retrain_checkpoint
--output_graph=/Users/saurav/Desktop/example/tmp/frozen_graph.pb --output_node_names=softmax
获取错误:UnicodeDecodeError:'utf-8'编解码器无法解码44位的字节0xff:无效的起始字节
最后我找到了答案。要冻结图形,您需要使用“bazel”构建。 1.使用自制软件安装bazel。 brew install bazel
2.如果你没有自制软件,请安装它。
/usr/bin/ruby -e "$(curl -fsSL \
https://raw.githubusercontent.com/Homebrew/install/master/install)"
git clone https://github.com/tensorflow/tensorflow
克隆张量流bazel build tensorflow/python/tools:freeze_graph
为freeze_graph构建bazelbazel-bin/tensorflow/python/tools/freeze_graph \ --input_graph=YouDirectory/retrained_graph.pb \ --input_checkpoint=YouDirectory/_retrain_checkpoint \ --output_graph=YouDirectory/frozen_graph.pb