Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 自定义图像数据集的微调inception_v3 FailedPremission错误_Python_Tensorflow_Models - Fatal编程技术网

Python 自定义图像数据集的微调inception_v3 FailedPremission错误

Python 自定义图像数据集的微调inception_v3 FailedPremission错误,python,tensorflow,models,Python,Tensorflow,Models,我正在使用tf(1.1.0和1.2.0)models/slim/scripts对我的2个自定义“logo”图像数据集(以前已转换为TFRecords)进行优化 码头工人 带tensorflow容器的windows全内置Docker,不带GPU docker run -it -v c:/tf_files:/tf_files gcr.io/tensorflow/tensorflow:1.1.0-devel (also 1.2.0-devel) TF记录 对于2个图像类别,使用LABELS_FILE

我正在使用tf(1.1.0和1.2.0)models/slim/scripts对我的2个自定义“logo”图像数据集(以前已转换为TFRecords)进行优化

码头工人 带tensorflow容器的windows全内置Docker,不带GPU

docker run -it -v c:/tf_files:/tf_files gcr.io/tensorflow/tensorflow:1.1.0-devel (also 1.2.0-devel)
TF记录 对于2个图像类别,使用LABELS_FILE=/tmp/data/LABELS.txt

ProperLogos
OtherLogos
克隆模型 将logos.py添加到数据集目录,并更新了dataset_factory.py以支持“logos”自定义数据集
更改了datatset_utils.py,其中更改了标签_文件名='labels2.txt' 因为它需要“标签\u id冒号名称””格式,就像我在代码中找到的那样

0:ProperLogos
1:OtherLogos
微调 启动第一个cmd序列\u图像\u分类器.py
从/tmp/checkpoints/inception_v3.ckpt进行微调

# Fine-tune only the new layers for 1000 steps.
python train_image_classifier.py \
  --train_dir=${TRAIN_DIR} \
  --dataset_name=logos \
  --dataset_split_name=train \
  --dataset_dir=${DATASET_DIR} \
  --model_name=inception_v3 \
  --checkpoint_path=${PRETRAINED_CHECKPOINT_DIR}/inception_v3.ckpt \
  --checkpoint_exclude_scopes=InceptionV3/Logits,InceptionV3/AuxLogits \
  --trainable_scopes=InceptionV3/Logits,InceptionV3/AuxLogits \
  --max_number_of_steps=1000 \
  --batch_size=12 \
  --learning_rate=0.01 \
  --learning_rate_decay_type=fixed \
  --save_interval_secs=60 \
  --save_summaries_secs=60 \
  --log_every_n_steps=100 \
  --clone_on_cpu=True \
  --optimizer=rmsprop \
  --weight_decay=0.00004
失败预处理错误时失败:/tmp/logos/train

 /slimtf/models/slim# ./scripts/finetune_inception_v3_on_logos.sh

INFO:tensorflow:Summary name /clone_loss is illegal; using clone_loss instead.
INFO:tensorflow:Ignoring --checkpoint_path because a checkpoint already exists in /tmp/models-logos4a/inception_v3
2017-07-02 02:11:51.859377: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-02 02:11:51.859402: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-02 02:11:51.859408: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-07-02 02:11:51.859413: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-02 02:11:51.859418: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
INFO:tensorflow:Restoring parameters from /tmp/models-logos4a/inception_v3/model.ckpt-0
INFO:tensorflow:Starting Session.
INFO:tensorflow:Saving checkpoint to path /tmp/models-logos4a/inception_v3/model.ckpt
INFO:tensorflow:Starting Queues.
INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.FailedPreconditionError'>, /tmp/logos/train
         [[Node: parallel_read/ReaderReadV2_1 = ReaderReadV2[_device="/job:localhost/replica:0/task:0/cpu:0"](parallel_read/TFRecordReaderV2_1, parallel_read/filenames)]]
2017-07-02 02:11:55.725083: W tensorflow/core/kernels/queue_base.cc:303] _6_prefetch_queue/fifo_queue: Skipping cancelled dequeue attempt with queue not closed
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:Caught OutOfRangeError. Stopping Training.
INFO:tensorflow:Finished training! Saving model to disk.
Traceback (most recent call last):
  File "train_image_classifier.py", line 573, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "train_image_classifier.py", line 569, 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 767, in train
    sv.stop(threads, close_summary_writer=True)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/supervisor.py", line 792, in stop
    stop_grace_period_secs=self._stop_grace_secs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/coordinator.py", line 389, in join
    six.reraise(*self._exc_info_to_raise)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/queue_runner_impl.py", line 238, in _run
    enqueue_callable()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1193, in _single_operation_run
    target_list_as_strings, status, None)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.FailedPreconditionError: /tmp/logos/train
         [[Node: parallel_read/ReaderReadV2_1 = ReaderReadV2[_device="/job:localhost/replica:0/task:0/cpu:0"](parallel_read/TFRecordReaderV2_1, parallel_read/filenames)]]
/tmp/标识/验证


能否指定对dataset_utils.py进行了哪些编辑?另外,查看logos.py也会很有帮助,因为我怀疑错误就在那里。@GPhilo你是对的,logos.py和实际上TFRecords的
####u文件模式='logos\u%s*.tfrecord''是问题所在。在对输入数据路径进行一些实验后发现。我也有同样的问题,这就是为什么我认为它可能在那里。无法将任何事情标记为已解决,是你提出了问题。我建议你对这个问题写一个简短的答案,并将该答案标记为解决问题Right@GPhilo,这是对能够回答问题的人的回答:o)你能指定你对dataset_utils.py做了哪些编辑吗?另外,查看logos.py也会很有帮助,因为我怀疑错误就在那里。@GPhilo你是对的,logos.py和实际上TFRecords的
####u文件模式='logos\u%s*.tfrecord''是问题所在。在对输入数据路径进行一些实验后发现。我也有同样的问题,这就是为什么我认为它可能在那里。无法将任何事情标记为已解决,是你提出了问题。我建议你为这个问题写一个简短的答案,并将该答案标记为正确解决问题@GPhilo,这是对能够回答问题的人的一个警告:o)
/slimtf/models/slim# ./scripts/finetune_inception_v3_on_logos.sh
# Fine-tune only the new layers for 1000 steps.
python train_image_classifier.py \
  --train_dir=${TRAIN_DIR} \
  --dataset_name=logos \
  --dataset_split_name=train \
  --dataset_dir=${DATASET_DIR} \
  --model_name=inception_v3 \
  --checkpoint_path=${PRETRAINED_CHECKPOINT_DIR}/inception_v3.ckpt \
  --checkpoint_exclude_scopes=InceptionV3/Logits,InceptionV3/AuxLogits \
  --trainable_scopes=InceptionV3/Logits,InceptionV3/AuxLogits \
  --max_number_of_steps=1000 \
  --batch_size=12 \
  --learning_rate=0.01 \
  --learning_rate_decay_type=fixed \
  --save_interval_secs=60 \
  --save_summaries_secs=60 \
  --log_every_n_steps=100 \
  --clone_on_cpu=True \
  --optimizer=rmsprop \
  --weight_decay=0.00004
 /slimtf/models/slim# ./scripts/finetune_inception_v3_on_logos.sh

INFO:tensorflow:Summary name /clone_loss is illegal; using clone_loss instead.
INFO:tensorflow:Ignoring --checkpoint_path because a checkpoint already exists in /tmp/models-logos4a/inception_v3
2017-07-02 02:11:51.859377: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-02 02:11:51.859402: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-02 02:11:51.859408: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-07-02 02:11:51.859413: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-02 02:11:51.859418: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
INFO:tensorflow:Restoring parameters from /tmp/models-logos4a/inception_v3/model.ckpt-0
INFO:tensorflow:Starting Session.
INFO:tensorflow:Saving checkpoint to path /tmp/models-logos4a/inception_v3/model.ckpt
INFO:tensorflow:Starting Queues.
INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.FailedPreconditionError'>, /tmp/logos/train
         [[Node: parallel_read/ReaderReadV2_1 = ReaderReadV2[_device="/job:localhost/replica:0/task:0/cpu:0"](parallel_read/TFRecordReaderV2_1, parallel_read/filenames)]]
2017-07-02 02:11:55.725083: W tensorflow/core/kernels/queue_base.cc:303] _6_prefetch_queue/fifo_queue: Skipping cancelled dequeue attempt with queue not closed
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:Caught OutOfRangeError. Stopping Training.
INFO:tensorflow:Finished training! Saving model to disk.
Traceback (most recent call last):
  File "train_image_classifier.py", line 573, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "train_image_classifier.py", line 569, 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 767, in train
    sv.stop(threads, close_summary_writer=True)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/supervisor.py", line 792, in stop
    stop_grace_period_secs=self._stop_grace_secs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/coordinator.py", line 389, in join
    six.reraise(*self._exc_info_to_raise)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/queue_runner_impl.py", line 238, in _run
    enqueue_callable()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1193, in _single_operation_run
    target_list_as_strings, status, None)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.FailedPreconditionError: /tmp/logos/train
         [[Node: parallel_read/ReaderReadV2_1 = ReaderReadV2[_device="/job:localhost/replica:0/task:0/cpu:0"](parallel_read/TFRecordReaderV2_1, parallel_read/filenames)]]
train-00000-of-00002  train-00001-of-00002
validation-00000-of-00002  validation-00001-of-00002