sirius-ai / MobileFaceNet_TF

Tensorflow implementation for MobileFaceNet
Apache License 2.0
434 stars 170 forks source link

error when i load the pretrained model #59

Closed zfs1993 closed 4 years ago

zfs1993 commented 4 years ago

it seems the pretrained model architecture is different from the architecutre in train_nets.py

Traceback (most recent call last): File "train_nets.py", line 212, in saver.restore(sess, ckpt.model_checkpoint_path) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1322, in restore err, "a mismatch between the current graph and the graph") tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [128] rhs shape= [192] [[node save/Assign_190 (defined at train_nets.py:201) ]]

Errors may have originated from an input operation. Input Source operations connected to node save/Assign_190: MobileFaceNet/Logits/LinearConv1x1/BatchNorm/moving_variance (defined at /DATA/app/OCR/zhangfs/mobile/MobileFaceNet_TF-master/nets/MobileFaceNet.py:231)

Original stack trace for 'save/Assign_190': File "train_nets.py", line 201, in saver = tf.train.Saver(tf.trainable_variables(), max_to_keep=args.saver_maxkeep) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 825, in init self.build() File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 837, in build self._build(self._filename, build_save=True, build_restore=True) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 875, in _build build_restore=build_restore) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 508, in _build_internal restore_sequentially, reshape) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 350, in _AddRestoreOps assign_ops.append(saveable.restore(saveable_tensors, shapes)) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saving/saveable_object_util.py", line 72, in restore self.op.get_shape().is_fully_defined()) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 227, in assign validate_shape=validate_shape) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 66, in assign use_locking=use_locking, name=name) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func return func(*args, **kwargs) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3616, in create_op op_def=op_def) File "/DATA/app/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2005, in init self._traceback = tf_stack.extract_stack()