質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

解決済

1回答

503閲覧

tensorflowでobject detectionのモデルの学習プログラムを動かしてるのですが、うまくGPUを使って学習ができません。

gjmwtaptm

総合スコア13

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2018/11/09 18:22

環境

AWSのDeep learning AMIを使ってEC2上で動かしています。

source activate tensorflow_p36し、
pip install -U tensorflowした状態で、

実行コマンドは下記です。(X)

python

1python object_detection/model_main.py --pipeline_config_path=configs/faster_rcnn_resnet101_voc07.config --model_dir=data/output-model/ --num_train_steps=50000 --sample_1_of_n_eval_examples=1 --alsologtostderr

https://github.com/tensorflow/models/blob/master/research/object_detection

問題

以下をobject_detection/model_main.pyに追加して、Xを実行すると

python

1from tensorflow.python.client import device_lib 2print(device_lib.list_local_devices())

2018-11-09 18:12:12.582533: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Device mapping:
/job:localhost/replica:0/task:0/device:XLA_CPU:0 -> device: XLA_CPU device
2018-11-09 18:12:12.591782: I tensorflow/core/common_runtime/direct_session.cc:307] Device mapping:
/job:localhost/replica:0/task:0/device:XLA_CPU:0 -> device: XLA_CPU device

とログに出てきて、GPUが使えていないようです。

やったこと

調べてみると、pip install tensorflow-gpu
を実行すればGPU使って学習できるいう記事を見つけたので、

https://github.com/tensorflow/models/issues/3366

以下を実行してからコードXを実行しました。

bash

1pip uninstall tensorflow 2pip uninstall tensorflow-gpu 3pip install -U tensorflow-gpu

しかし下記のエラーがでます。(少なくとも確認した限りバージョン:1.6,1.8,1.11で発生)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

これの解決策としては、tensorflow-gpu:1.4にするといいようです。
https://github.com/tensorflow/tensorflow/issues/15604

そこで、下記を実行してコードXを実行しました。

bash

1pip uninstall tensorflow 2pip uninstall tensorflow-gpu 3pip install --upgrade tensorflow-gpu==1.4

しかしAttributeError: module 'tensorflow.python.keras' has no attribute 'Model'
というエラーが出ます。

これの解決策としては、pip install -U tensorflowを実行することが提案されており、無限ループに陥ってしまっています。
https://github.com/tensorflow/tensorflow/issues/21927

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

source activate mxnet_p36
pip install -U tensorflow-gpu
でコマンドXでうまくいきました。

投稿2018/11/10 14:35

gjmwtaptm

総合スコア13

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問