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

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

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

CUDAは並列計算プラットフォームであり、Nvidia GPU(Graphics Processing Units)向けのプログラミングモデルです。CUDAは様々なプログラミング言語、ライブラリ、APIを通してNvidiaにインターフェイスを提供します。

Keras

Kerasは、TheanoやTensorFlow/CNTK対応のラッパーライブラリです。DeepLearningの数学的部分を短いコードでネットワークとして表現することが可能。DeepLearningの最新手法を迅速に試すことができます。

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

0回答

704閲覧

動画を開いた状態でkeras-yolov3を動かすとエラーをはいてしまう

caramel

総合スコア14

CUDA

CUDAは並列計算プラットフォームであり、Nvidia GPU(Graphics Processing Units)向けのプログラミングモデルです。CUDAは様々なプログラミング言語、ライブラリ、APIを通してNvidiaにインターフェイスを提供します。

Keras

Kerasは、TheanoやTensorFlow/CNTK対応のラッパーライブラリです。DeepLearningの数学的部分を短いコードでネットワークとして表現することが可能。DeepLearningの最新手法を迅速に試すことができます。

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2021/07/02 07:53

前提・実現したいこと

環境
os - windows10
anaconda3
tensorflow_gpu-1.14.0
cuDNN-7.4.2
CUDA-10.0
keras-yolov3(参照元 - https://github.com/qqwweee/keras-yolo3)

問題点
yolo.pyのソースコードに少しだけ付け加えて、
webカメラを使ったリアルタイム検出を行っています。

その際、他のアプリ(goole chromeやエクスプローラーなど)を開いた状態で
コンパイルしてもエラーは起きないのに、
動画を開いた状態でコンパイルするとエラーになってしまいます。
画像を開いた状態でのコンパイルはエラーは起きません。

他のPC(gpu搭載、環境もほとんど変わらない)で動かした場合は、
動画を開いた状態でもエラーは起こっていません。

ソースコードに問題はないため、
自分のpcの環境に問題があると思っていますが、
原因がよくわかりません。

ご教授お願いいたします。

発生している問題・エラーメッセージ

model_data/yolo.h5 model, anchors, and classes loaded.
W0702 16:38:43.878128 1568 deprecation.py:323] From C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\ops\array_ops.py:1354: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
(416, 416, 3)
2021-07-02 16:38:49.158428: E tensorflow/core/grappler/optimizers/meta_optimizer.cc:502] remapper failed: Invalid argument: Subshape must have computed start >= end since stride is negative, but is 0 and 2 (computed from start 0 and end 9223372036854775807 over shape with rank 2 and stride-1)
2021-07-02 16:38:49.374394: E tensorflow/core/grappler/optimizers/meta_optimizer.cc:502] layout failed: Invalid argument: Subshape must have computed start >= end since stride is negative, but is 0 and 2 (computed from start 0 and end 9223372036854775807 over shape with rank 2 and stride-1)
2021-07-02 16:38:49.654057: E tensorflow/core/grappler/optimizers/meta_optimizer.cc:502] remapper failed: Invalid argument: Subshape must have computed start >= end since stride is negative, but is 0 and 2 (computed from start 0 and end 9223372036854775807 over shape with rank 2 and stride-1)
2021-07-02 16:38:50.914065: E tensorflow/stream_executor/cuda/cuda_dnn.cc:329] Could not create cudnn handle: CUDNN_STATUS_ALLOC_FAILED
2021-07-02 16:38:50.914675: E tensorflow/stream_executor/cuda/cuda_dnn.cc:329] Could not create cudnn handle: CUDNN_STATUS_ALLOC_FAILED
Traceback (most recent call last):
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
return fn(*args)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
(0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[{{node conv2d_1/convolution}}]]
[[boolean_mask_120/GatherV2/_3383]]
(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[{{node conv2d_1/convolution}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "yolo2.py", line 215, in <module>
detect_video(YOLO(),video_path)
File "yolo2.py", line 192, in detect_video
image = yolo.detect_image(image)
File "yolo2.py", line 124, in detect_image
K.learning_phase(): 0
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\client\session.py", line 950, in run
run_metadata_ptr)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run
feed_dict_tensor, options, run_metadata)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
run_metadata)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
(0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[node conv2d_1/convolution (defined at C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\backend\tensorflow_backend.py:3650) ]]
[[boolean_mask_120/GatherV2/_3383]]
(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[node conv2d_1/convolution (defined at C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\backend\tensorflow_backend.py:3650) ]]
0 successful operations.
0 derived errors ignored.

Errors may have originated from an input operation.
Input Source operations connected to node conv2d_1/convolution:
input_1 (defined at C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\backend\tensorflow_backend.py:517)

conv2d_1/kernel/read (defined at C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\backend\tensorflow_backend.py:402)

Input Source operations connected to node conv2d_1/convolution:
input_1 (defined at C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\backend\tensorflow_backend.py:517)

conv2d_1/kernel/read (defined at C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\backend\tensorflow_backend.py:402)

Original stack trace for 'conv2d_1/convolution':
File "yolo2.py", line 215, in <module>
detect_video(YOLO(),video_path)
File "yolo2.py", line 45, in init
self.boxes, self.scores, self.classes = self.generate()
File "yolo2.py", line 70, in generate
self.yolo_model = load_model(model_path, compile=False)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\engine\saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\engine\saving.py", line 225, in deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\engine\saving.py", line 458, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\layers_init
.py", line 55, in deserialize
printable_module_name='layer')
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\utils\generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items())))
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\engine\network.py", line 1032, in from_config
process_node(layer, node_data)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\engine\network.py", line 991, in process_node
layer(unpack_singleton(input_tensors), **kwargs)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\engine\base_layer.py", line 457, in call
output = self.call(inputs, **kwargs)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\layers\convolutional.py", line 171, in call
dilation_rate=self.dilation_rate)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\keras\backend\tensorflow_backend.py", line 3650, in conv2d
data_format=tf_data_format)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 894, in convolution
name=name)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 971, in convolution_internal
name=name)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1071, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "C:\Users\shinchi\Anaconda3\envs\kami\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in init
self._traceback = tf_stack.extract_stack()

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

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

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

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

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

jbpb0

2021/07/03 12:49

> CUDNN_STATUS_ALLOC_FAILED GPUのメモリーが不足しているのかもしれません エラーが起きるパソコンと起きないパソコンのそれぞれで、タスクマネージャーでGPUのメモリーの使用状況をモニターして、比較してみてください ・yoloを実行する前に、動画再生した状態でのGPUメモリーの余裕 ・上記の状態でyoloを実行した時の、GPUメモリーの余裕 が、どちらも同じくらいか? 参考 https://btopcs.jp/basic/before/parts/gpumemory/ の「GPUメモリ使用量の確認方法」
caramel

2021/10/12 14:27

マザボが壊れてしまって、ごたごたしていたら返信遅れました、すみません。 osも入れ替え、色々と新しくしたら解決してました。 返信ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問