<p>The checkpoint files contain additional information that is useful during training but is not necessary for inference. For example, the <a href="https://www.tensorflow.org/api_docs/python/tf/train/AdamOptimizer" rel="nofollow noreferrer"><code>tf.train.AdamOptimizer</code></a>, which implements the <a href="https://arxiv.org/abs/1412.6980" rel="nofollow noreferrer">Adam optimization algorithm</a>, stores two additional "moment vectors" for each variable being optimized, which means that the training state is approximately <strong>three times larger</strong> than the variables being optimized. These moment vectors are not needed when you perform inference, so the frozen graph can be much smaller.</p>
Size of output_graph.pb generated using freeze_graph.py is smaller than the size of the weights of the variables Tensorflow
<p>After Saving my Tensorflow model the following files were generated:</p>

<pre><code>checkpoint
input_graph.pb
tmp.ckpt.data-00000-of-00001
tmp.ckpt.index
tmp.ckpt.meta
</code></pre>

<p>I generated output_graph.pb using freeze_graph.py feeding it the inputs:</p>

<pre><code>freeze_graph.py --input_graph=graph.pb --input_checkpoint=tmp.ckpt --output_graph=frozen_graph.pb --output_node_names="Dense2/output_node"
</code></pre>

<p>The size of output_graph.pb is around 615 kb whereas the size of tmp.ckpt.data-00000-of-00001 is around 1.5 MB. This is my tensorflow model:</p>

<pre><code>X =  tf.placeholder(tf.float32, [None,training_set.shape[1]],name = "input_node")
Y = tf.placeholder(tf.float32,[None,training_labels.shape[1]], name = 'Y')

with tf.name_scope('Dense1'):
    W1 = tf.get_variable( "W1", [40, training_set.shape[1]], dtype=tf.float32, initializer = tf.contrib.layers.xavier_initializer(seed = 0) )
    b1 = tf.get_variable( "b1", [40,1], dtype=tf.float32,initializer=tf.zeros_initializer() )
    A1 = tf.add(tf.matmul( W1, tf.transpose( X ) ), b1 )
    A1 = tf.nn.relu( A1 )
    A1 = tf.nn.dropout( A1, 0.8, name="A1" )

with tf.name_scope('Dense2'):
    W2 = tf.get_variable( "W2", [2, 40], dtype=tf.float32, initializer = tf.contrib.layers.xavier_initializer(seed = 0) )
    b2 = tf.get_variable( "b2",[2,1], dtype=tf.float32, initializer=tf.zeros_initializer() )
    A2 = tf.add( tf.matmul( W2, A1 ), b2 )
    A2 = tf.transpose( A2, name="output_node" )

print("Initialsing cost")
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits = A2, labels = Y))
print("Initialsing optimizer")
global_step = tf.Variable(0, trainable=False)
start_learning_rate = 0.001
learning_rate = tf.train.exponential_decay(start_learning_rate, global_step, 200, 0.1, True )
optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate).minimize(cost)
</code></pre>

<p>Any idea on what went wrong?. Also any suggestions which will help me analyze output_graph.pb will be greatly appreciated</p>