dailystudio / ml

ML related stuff
Apache License 2.0
140 stars 48 forks source link

Running for mobilenet trained on ImageNet #12

Open Jnasic opened 5 years ago

Jnasic commented 5 years ago

Hello! First of all thanks for this great repo. Actually I am working on running model on android. I am using Imagenet trained model

https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet But when I run export_model as you have written It gives me following error.

INFO:tensorflow:Restoring parameters from model/mobilenet_v2_1.0_96.ckpt 2019-06-26 01:35:30.648418: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key logits/semantic/weights not found in checkpoint 2019-06-26 01:35:30.649013: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key logits/semantic/biases not found in checkpoint 2019-06-26 01:35:30.651016: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key image_pooling/weights not found in checkpoint 2019-06-26 01:35:30.652490: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key image_pooling/BatchNorm/moving_variance not found in checkpoint 2019-06-26 01:35:30.654040: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key image_pooling/BatchNorm/moving_mean not found in checkpoint 2019-06-26 01:35:30.655293: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key image_pooling/BatchNorm/gamma not found in checkpoint 2019-06-26 01:35:30.656465: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key image_pooling/BatchNorm/beta not found in checkpoint 2019-06-26 01:35:30.658158: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key concat_projection/weights not found in checkpoint 2019-06-26 01:35:30.660121: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key concat_projection/BatchNorm/moving_variance not found in checkpoint 2019-06-26 01:35:30.662927: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key concat_projection/BatchNorm/moving_mean not found in checkpoint 2019-06-26 01:35:30.665587: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key concat_projection/BatchNorm/gamma not found in checkpoint 2019-06-26 01:35:30.667224: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key concat_projection/BatchNorm/beta not found in checkpoint 2019-06-26 01:35:30.668163: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key aspp0/weights not found in checkpoint 2019-06-26 01:35:30.669490: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key aspp0/BatchNorm/moving_variance not found in checkpoint 2019-06-26 01:35:30.670347: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key aspp0/BatchNorm/moving_mean not found in checkpoint 2019-06-26 01:35:30.671525: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key aspp0/BatchNorm/gamma not found in checkpoint 2019-06-26 01:35:30.672480: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key aspp0/BatchNorm/beta not found in checkpoint Traceback (most recent call last): File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_call return fn(*args) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1329, in _run_fn status, run_metadata) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.NotFoundError: Key logits/semantic/weights not found in checkpoint [[Node: save/RestoreV2_271 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_271/tensor_names, save/RestoreV2_271/shape_and_slices)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "export_model.py", line 186, in tf.app.run() File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 124, in run _sys.exit(main(argv)) File "export_model.py", line 177, in main initializer_nodes=None) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/tools/freeze_graph.py", line 104, in freeze_graph_with_def_protos saver.restore(sess, input_checkpoint) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1686, in restore {self.saver_def.filename_tensor_name: save_path}) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 895, in run run_metadata_ptr) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1128, in _run feed_dict_tensor, options, run_metadata) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1344, in _do_run options, run_metadata) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1363, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.NotFoundError: Key logits/semantic/weights not found in checkpoint [[Node: save/RestoreV2_271 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_271/tensor_names, save/RestoreV2_271/shape_and_slices)]]

Caused by op 'save/RestoreV2_271', defined at: File "export_model.py", line 186, in tf.app.run() File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 124, in run _sys.exit(main(argv)) File "export_model.py", line 163, in main saver = tf.train.Saver(tf.all_variables()) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1239, in init self.build() File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1248, in build self._build(self._filename, build_save=True, build_restore=True) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1284, in _build build_save=build_save, build_restore=build_restore) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 765, in _build_internal restore_sequentially, reshape) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 428, in _AddRestoreOps tensors = self.restore_op(filename_tensor, saveable, preferred_shard) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 268, in restore_op [spec.tensor.dtype])[0]) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1031, in restore_v2 shape_and_slices=shape_and_slices, dtypes=dtypes, name=name) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3160, in create_op op_def=op_def) File "/home/abdullah/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1625, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

NotFoundError (see above for traceback): Key logits/semantic/weights not found in checkpoint [[Node: save/RestoreV2_271 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_271/tensor_names, save/RestoreV2_271/shape_and_slices)]]

Kindly help me