Freezing the exported Graph


I wanted to create a frozen model while I already have an exported model plus a checkpoint.  After several browsing, I found out this website and decided to try on my Mac.


Unfortunately, while exporting the graph with command below, but failed. It complained about XCode.

bazel build tensorflow/python/tools:freeze_graph
bazel-bin/tensorflow/python/tools/freeze_graph \
--input_graph=/tmp/inception_v3_inf_graph.pb \
--input_checkpoint=/tmp/checkpoints/inception_v3.ckpt \
--input_binary=true --output_graph=/tmp/frozen_inception_v3.pb \
  --output_node_names=InceptionV3/Predictions/Reshape_1 

Then from StackOverflow, I got this solution,
bazel clean --expunge 
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
bazel clean --expunge 
But that was not the only challenge to get this work. Another obstacle appears where my Macbook started to die. Apparently Bazel eats up of the memories on my Macbook.

I have to cancel the build and re-execute again bazel. At this time, I had to limit the job so it will not eat my resources.

bazel build --jobs=10 tensorflow/python/tools:freeze_graph
Voila, it works.

Comments