jiangxiluning / facenet_mtcnn_to_mobile

convert facenet and mtcnn models from tensorflow to tensorflow lite and coreml (使用 TFLite 将 FaceNet 和 MTCNN 移植到移动端)
MIT License
197 stars 49 forks source link

Inference - Freezing the eval model asserts for embeddings #7

Open milinddeore opened 5 years ago

milinddeore commented 5 years ago

I have successfully transformed the model (.pb) to eval model using following command:

python3 eval_graph.py model_pc model_pc_eval

But freezing the graph gives following error:


2019-02-25 12:22:03.793509: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Model directory: model_pc_eval/
Metagraph file: imagenet_facenet.ckpt.meta
Checkpoint file: imagenet_facenet.ckpt
WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
WARNING:tensorflow:From src/freeze_graph.py:90: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.convert_variables_to_constants
WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py:245: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.extract_sub_graph
Traceback (most recent call last):
  File "src/freeze_graph.py", line 103, in <module>
    main(parse_arguments(sys.argv[1:]))
  File "src/freeze_graph.py", line 58, in main
    output_graph_def = freeze_graph_def(sess, input_graph_def, 'embeddings,label_batch')
  File "src/freeze_graph.py", line 90, in freeze_graph_def
    variable_names_whitelist=whitelist_names)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py", line 245, in convert_variables_to_constants
    inference_graph = extract_sub_graph(input_graph_def, output_node_names)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py", line 181, in extract_sub_graph
    _assert_nodes_are_present(name_to_node, dest_nodes)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py", line 137, in _assert_nodes_are_present
    assert d in name_to_node, "%s is not in graph" % d
AssertionError: embeddings is not in graph```