TensorFlow:向协调员报告错误:<type'exception.typeerror'=“”>尽管指定了一个检查点来恢复模型?

时间:2017-01-09 10:19:30

标签: python machine-learning tensorflow deep-learning tf-slim

我正在尝试使用此处的TF-slim源代码测试传输学习:https://github.com/tensorflow/models/blob/master/slim/train_image_classifier.py

我使用的数据集是鲜花数据集,我已根据代码的要求将其转换为TFRecords。我还采取了预防措施,不将TFRecords文件保存在我的tmp文件夹中,因为它将面临我之前遇到的权限错误。但是,尽管指定要恢复的检查点,但我得到了一个令人费解的INFO:tensorflow:Fine-tuning from None标准输出。然后错误继续给我一个TypeError,可以在下面的错误跟踪中找到。

我运行了以下命令: python train_image_classifier.py --optimizer=adam --dataset_name=flowers --dataset_dir=/home/kwotsin/Datasets/flower_photos_tfrecords/ --model_name=inception_resnet_v2 --train_image_size=299 --checkpoint_path=/home/kwotsin/Datasets/Inception_resnet_v2_weights/

为什么TensorFlow无法检测到.ckpt文件的存在以恢复模型并从那时起进行微调?

这是我的错误堆栈跟踪:

I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
INFO:tensorflow:Fine-tuning from None
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 0 with properties: 
name: GeForce GTX 860M
major: 5 minor: 0 memoryClockRate (GHz) 1.0195
pciBusID 0000:01:00.0
Total memory: 3.95GiB
Free memory: 3.35GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0:   Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 860M, pci bus id: 0000:01:00.0)
INFO:tensorflow:Error reported to Coordinator: <type 'exceptions.TypeError'>, Expected binary or unicode string, got None
Traceback (most recent call last):
  File "train_image_classifier.py", line 585, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run
    sys.exit(main(sys.argv[:1] + flags_passthrough))
  File "train_image_classifier.py", line 581, in main
    sync_optimizer=optimizer if FLAGS.sync_replicas else None)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/slim/python/slim/learning.py", line 753, in train
    master, start_standard_services=False, config=session_config) as sess:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/supervisor.py", line 969, in managed_session
    self.stop(close_summary_writer=close_summary_writer)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/supervisor.py", line 797, in stop
    stop_grace_period_secs=self._stop_grace_secs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/coordinator.py", line 386, in join
    six.reraise(*self._exc_info_to_raise)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/supervisor.py", line 958, in managed_session
    start_standard_services=start_standard_services)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/supervisor.py", line 715, in prepare_or_wait_for_session
    init_feed_dict=self._init_feed_dict, init_fn=self._init_fn)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/session_manager.py", line 235, in prepare_session
    init_fn(sess)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/variables.py", line 581, in callback
    saver.restore(session, model_path)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1340, in restore
    if not file_io.get_matching_files(file_path):
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 231, in get_matching_files
    compat.as_bytes(filename), status)]
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/compat.py", line 64, in as_bytes
    (bytes_or_text,))
TypeError: Expected binary or unicode string, got None

0 个答案:

没有答案