无法获取卷积算法.在Tensorflow图像识别中



我正在尝试构建一个使用tensorflow模型进行图像识别的对象检测器,但由于此错误,我无法使其工作。我是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:pythonlibsite-packagestensorflow_corepythoneagerfunction.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:pythonlibsite-packagestensorflow_corepythoneagerfunction.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:pythonlibsite-packagestensorflow_corepythoneagerfunction.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:pythonlibsite-packagestensorflow_corepythoneagerfunction.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:pythonlibsite-packagestensorflow_corepythoneagerexecute.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 = [
~AppDataRoamingPythonPython37site-packagessix.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

我有tesorflow版本:2.1.0

Cuda版本:10.2

CUDNN版本:7.6.5

我也遇到过这个问题。我不确定原因,但我怀疑这与GPU内存有关。当我有太多python实例运行时,我注意到我会出现这个错误。当我杀死其他python实例时,错误就会消失。因此,请尝试只运行一个python实例。当我使用pip安装Tensorflow 2时,我也遇到了类似的问题。如果错误仍然存在,请卸载Tensorflow 2,然后使用Conda重新安装它。Conda会自动安装所有GPU依赖项CUDA和CUDNN。

最新更新