train_image_classifier運行在只有CPU設備下InvalidArgumentError錯誤

步驟

使用slim運行train_image_classifier.py

run train_image_classifier.py \

  --train_dir=satellite/train_dir \

  --dataset_name=satellite \

  --dataset_split_name=train \

  --dataset_dir=satellite/data \

  --model_name=inception_v3 \

  --checkpoint_path=satellite/pretrained/inception_v3.ckpt \

  --checkpoint_exclude_scopes=InceptionV3/Logits,InceptionV3/AuxLogits \

  --trainable_scopes=InceptionV3/Logits,InceptionV3/AuxLogits \

  --max_number_of_steps=100000 \

  --batch_size=32 \

  --learning_rate=0.001 \

  --learning_rate_decay_type=fixed \

  --save_interval_secs=300 \

  --save_summaries_secs=2 \

  --log_every_n_steps=10 \

  --optimizer=rmsprop \

  --weight_decay=0.00004

 

問題

報如下錯誤:

InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'InceptionV3/AuxLogits/Conv2d_2b_1x1/biases/RMSProp_1': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/cpu:0 ]. Make sure the device specification refers to a valid device.

分析:代碼指定使用GPU運行,但電腦只有CPU。

解決

只用CPU來運行。

將train_image_classifier.py:

tf.app.Flags.DEFINE_boolean('clone_on_cpu',False,'use CPUs to deploy clones.')

改爲:

tf.app.Flags.DEFINE_boolean('clone_on_cpu',True,'use CPUs to deploy clones.')

看,運行起來了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章