[英]Failed to get convolution algorithm. In Tensorflow Image Recognition
I'm trying to build an object detector that uses a tensorflow model for image recognition but I can't get it to work due to this error.我正在尝试构建一个使用 tensorflow 模型进行图像识别的对象检测器,但由于此错误,我无法使其正常工作。 I'm new to GPUs so a detailed help would be highly appreciated.我是 GPU 的新手,因此非常感谢详细的帮助。
----> 2 show_inference(detection_model, image_path)
<ipython-input-15-e474e557b383> in show_inference(model, image_path)
4 image_np = np.array(Image.open(image_path))
5 # Actual detection.
----> 6 output_dict = run_inference_for_single_image(model, image_np)
7 # Visualization of the results of a detection.
8 vis_util.visualize_boxes_and_labels_on_image_array(
<ipython-input-14-4110867dcb70> in run_inference_for_single_image(model, image)
7
8 # Run inference
----> 9 output_dict = model(input_tensor)
10
11 # All outputs are batches tensors.
D:\python\lib\site-packages\tensorflow_core\python\eager\function.py in __call__(self, *args, **kwargs)
1549 TypeError: For invalid positional/keyword argument combinations.
1550 """
-> 1551 return self._call_impl(args, kwargs)
1552
1553 def _call_impl(self, args, kwargs, cancellation_manager=None):
D:\python\lib\site-packages\tensorflow_core\python\eager\function.py in _call_impl(self, args, kwargs, cancellation_manager)
1589 raise TypeError("Keyword arguments {} unknown. Expected {}.".format(
1590 list(kwargs.keys()), list(self._arg_keywords)))
-> 1591 return self._call_flat(args, self.captured_inputs, cancellation_manager)
1592
1593 def _filtered_call(self, args, kwargs):
D:\python\lib\site-packages\tensorflow_core\python\eager\function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
1690 # No tape is watching; skip to running the function.
1691 return self._build_call_outputs(self._inference_function.call(
-> 1692 ctx, args, cancellation_manager=cancellation_manager))
1693 forward_backward = self._select_forward_and_backward_functions(
1694 args,
D:\python\lib\site-packages\tensorflow_core\python\eager\function.py in call(self, ctx, args, cancellation_manager)
543 inputs=args,
544 attrs=("executor_type", executor_type, "config_proto", config),
--> 545 ctx=ctx)
546 else:
547 outputs = execute.execute_with_cancellation(
D:\python\lib\site-packages\tensorflow_core\python\eager\execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
65 else:
66 message = e.message
---> 67 six.raise_from(core._status_to_exception(e.code, message), None)
68 except TypeError as e:
69 keras_symbolic_tensors = [
~\AppData\Roaming\Python\Python37\site-packages\six.py in raise_from(value, from_value)
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 FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/BatchNorm/batchnorm/mul_1 (defined at <ipython-input-7-f8a3c92a04a4>:11) ]]
[[Postprocessor/BatchMultiClassNonMaxSuppression/mul/_54]]
(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 FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/BatchNorm/batchnorm/mul_1 (defined at <ipython-input-7-f8a3c92a04a4>:11) ]]
0 successful operations.
0 derived errors ignored. [Op:__inference_pruned_16996]
Function call stack:
pruned -> pruned
I have tesorflow version : 2.1.0我有 tesorflow 版本:2.1.0
Cuda version: 10.2 Cuda 版本:10.2
CUDNN version : 7.6.5 CUDNN 版本:7.6.5
I have encountered this problem as well.我也遇到过这个问题。 I am not sure of the cause but I suspect it has something to do with GPU memory.我不确定原因,但我怀疑它与 GPU 内存有关。 I notice I get this error when I have too many instances of python running.我注意到当我运行太多 python 实例时会出现此错误。 The error goes away when I kill the other python instances.当我杀死其他 python 实例时,错误消失了。 So try it with only the single instance of python running.因此,仅在运行 python 的单个实例时尝试一下。 I also had similar problem when I installed Tensorflow 2 using pip.当我使用 pip 安装 Tensorflow 2 时,我也遇到了类似的问题。 If the error persists uninstall Tensorflow 2 then reinstall it using Conda.如果错误仍然存在,请卸载 Tensorflow 2,然后使用 Conda 重新安装它。 Conda installs all the GPU dependencies CUDA and CUDNN automatically. Conda 会自动安装所有 GPU 依赖项 CUDA 和 CUDNN。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.