前提・実現したいこと
環境
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()
あなたの回答
tips
プレビュー