我有一个项目,正在使用预训练的RestNet50模型。我训练了模型,存储了检查点,现在尝试加载存储的检查点,但是出现此错误。
Loading initial_checkpoint: /content/resnet/resnet_v1_50.ckpt
WARNING:tensorflow:From /content/pose-sensitive-embedding/helper/checkpoint_helper.py:27: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.
Traceback (most recent call last):
File "/content/pose-sensitive-embedding/trainer_views.py", line 100, in <module>
main()
File "/content/pose-sensitive-embedding/trainer_views.py", line 94, in main
args.num_classes)
File "/content/pose-sensitive-embedding/trainer_views.py", line 37, in start_training
run_training(dataset_factory, batch_size, batch_threads, epoch, estimator, num_epochs, image_size)
File "/content/pose-sensitive-embedding/trainer_views.py", line 53, in run_training
estimator.train(input_fn=train_input_function)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/estimator.py", line 370, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/estimator.py", line 1161, in _train_model
return self._train_model_default(input_fn, hooks, saving_listeners)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/estimator.py", line 1191, in _train_model_default
features, labels, ModeKeys.TRAIN, self.config)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/estimator.py", line 1149, in _call_model_fn
model_fn_results = self._model_fn(features=features, \**kwargs)
File "/content/pose-sensitive-embedding/helper/model_helper.py", line 49, in model_fn
check_init_from_initial_checkpoint(output_directory, initial_checkpoint, checkpoint_exclude_scopes, ignore_missing_variables)
File "/content/pose-sensitive-embedding/helper/checkpoint_helper.py", line 14, in check_init_from_initial_checkpoint
init_from_checkpoint(initial_checkpoint, checkpoint_exclude_scopes, ignore_missing_variables)
File "/content/pose-sensitive-embedding/helper/checkpoint_helper.py", line 20, in init_from_checkpoint
tf.contrib.framework.init_from_checkpoint(initial_checkpoint, variables_dictionary)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/framework/python/framework/checkpoint_utils.py", line 244, in init_from_checkpoint
tensor_name_in_ckpt, checkpoint_dir, variable_map
**ValueError**: Tensor resnet_v1_50/conv1/weights is not found in /content/resnet/resnet_v1_50.ckpt checkpoint {'w2_3': [5], 'w2_2': [5], 'w1': [2], 'w2_1': [5], 'w1_2': [2], 'w1_3': [2], 'w1_1': [2], 'w2': [5]}
我尝试了不同的预训练ImageNet模型,但仍然遇到相同的错误。我尝试过RestNet_v1_50,inceptionV4和Inception-ResNet-V2。此错误与代码有关还是我必须导入更多东西才能导入预训练的Image模型。
我正在尝试运行研究论文的代码。该研究论文的GitHub链接如下。 https://github.com/pse-ecn/pose-sensitive-embedding