def compare_inception_v3(src1, src2): graph = tf.Graph() with graph.as_default(): with tf.Session() as sess: network = inception_v3(sess) network.restore_graph(src1) weights = network.get_all_weights() network.restore_graph(src2) total_weight, equal_weight = network.comp_graph(weights) print ('Total weight : %d / Equal weight : %d' % \ (total_weight, equal_weight))
def generate_pretrained_prunable_inception_v3(src, dst): graph = tf.Graph() with graph.as_default(): with tf.Session() as sess: network = inception_v3(sess) network.restore_graph(src) weights = network.get_all_weights() tf.reset_default_graph() graph = tf.Graph() with graph.as_default(): with tf.Session() as sess: network = prunable_inception_v3(sess) network.replace_graph(weights) network.save_graph(dst)
def print_inception_v3(src): with tf.Session() as sess: network = inception_v3(sess) network.restore_graph(src) network.print_all_weights()
def generate_pretrained_inception_v3(src, dst): with tf.Session() as sess: network = inception_v3(sess) network.restore_graph(src) network.save_graph(dst)
def generate_zero_inception_v3(dst): with tf.Session() as sess: network = inception_v3(sess) network.reset_all_weights() network.save_graph(dst)