print_slim_output.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
  2. # Full license terms provided in LICENSE.md file.
  3. import tensorflow as tf
  4. import sys
  5. sys.path.append("third_party/models/research/")
  6. sys.path.append("third_party/models")
  7. sys.path.append("third_party/")
  8. sys.path.append("third_party/models/research/slim/")
  9. sys.path.append("scripts")
  10. import tensorflow.contrib.slim as tf_slim
  11. import slim.nets as nets
  12. import slim.nets.vgg
  13. from model_meta import NETS
  14. if __name__ == '__main__':
  15. with open("data/output_names.txt", 'w') as f:
  16. for net_name, net_meta in NETS.items():
  17. tf.reset_default_graph()
  18. tf_sess = tf.Session()
  19. tf_input = tf.placeholder(
  20. tf.float32,
  21. (
  22. None,
  23. net_meta['input_height'],
  24. net_meta['input_width'],
  25. net_meta['input_channels']
  26. ),
  27. name=net_meta['input_name']
  28. )
  29. with tf_slim.arg_scope(net_meta['arg_scope']()):
  30. tf_net, tf_end_points = net_meta['model'](
  31. tf_input,
  32. is_training=False,
  33. num_classes=net_meta['num_classes']
  34. )
  35. print("Output name for %s is %s" % (net_name, tf_net.name))
  36. f.write("%s\t%s\n" % (net_name, tf_net.name))
  37. f.close()