Skip to content

Commit

Permalink
Enabling OpenVINO: freeze GQCNN graph
Browse files Browse the repository at this point in the history
GQCNNTF.initialize_network() is updated to freeze the GQCNN graph,
right after the initialization of the network.

This code block is inactive unless explicitly switching the `if`
condition into `True` when freezing is needed.

A frozen graph is expected by the Model Optimizer of OpenVINO™.

Signed-off-by: Sharron LIU <[email protected]>
  • Loading branch information
sharronliu committed Dec 6, 2019
1 parent c683ad2 commit fa923de
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gqcnn/model/tf/network_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,19 @@ def initialize_network(self,
if add_sigmoid:
self.add_sigmoid_to_output()

# Freeze graph. Make it 'True' to freeze this graph
if False:
from tensorflow.python.framework import graph_io, graph_util
self.open_session()
frozen = graph_util.convert_variables_to_constants(
self._sess, self._sess.graph_def, ["softmax/Softmax"])
graph_io.write_graph(frozen,
".",
"inference_graph_frozen.pb",
as_text=False)
self.close_session()
self._logger.info("Wrote frozen graph")

# Create feed tensors for prediction.
self._input_im_arr = np.zeros((self._batch_size, self._im_height,
self._im_width, self._num_channels))
Expand Down

0 comments on commit fa923de

Please sign in to comment.