load_features.py 563 B

12345678910111213141516171819202122232425262728
  1. '''
  2. Base file for using the features that were computed and stored in the pickle file.
  3. This is tensorflow agnostic
  4. Ex. python load_features.py inception_v1_features.pkl
  5. '''
  6. import numpy as np
  7. import sys
  8. import cPickle as pickle
  9. if __name__ == '__main__':
  10. try:
  11. pkl_file = open(sys.argv[1], 'rb')
  12. features = pickle.load(pkl_file)
  13. except:
  14. print('Must provide a pickle file')
  15. exit()
  16. for image, feature in features.iteritems():
  17. print(image, ':', feature)
  18. exit()
  19. # do whatever you want with features