davidsandberg / facenet

Face recognition using Tensorflow
MIT License
13.71k stars 4.8k forks source link

Toooo Slow #530

Open MengWangTHU opened 6 years ago

MengWangTHU commented 6 years ago

When I reload the local pre-trained model 20170512-110547, the programming gose soooo slow, even to 1min. Dose anybody run into this problem? My programming is as below : `sess = tf.Session() saver = tf.train.import_meta_graph('./newmodel/model-20170512-110547.ckpt.meta') model_checkpoint_path = './newmodel/model-20170512-110547.ckpt' saver.restore(sess, model_checkpoint_path)

images_placeholder = tf.get_default_graph().get_tensor_by_name("input:0")
embeddings = tf.get_default_graph().get_tensor_by_name("embeddings:0")
phase_train_placeholder = tf.get_default_graph().get_tensor_by_name("phase_train:0")

#initialize embeddings dict
emb_dict = {}
# sess.run(tf.initialize_all_variables())
for guy in imgdata:
    # sess.run(init)
    # emb_dict[guy] = list(sess.run([embeddings], feed_dict={images_placeholder: np.array(data[guy]), phase_train_placeholder: False })[0])
    emb_dict[guy] = list(sess.run([embeddings], feed_dict={images_placeholder: np.array(imgdata[guy]), phase_train_placeholder: False})[0])
return emb_dict`
davidsandberg commented 6 years ago

If you freeze the model it will be quickernto load. See freeze_graph.py.

ninnyyan commented 5 years ago

@MengWangTHU hi, I am looking for the 20170512-110547 pre-trained model now but not found, could you please send me the file? Thank you so much. @davidsandberg hello, where can I find the previous version of pre-trained model? thank you!