Python (0)未知:获取卷积算法失败。这可能是因为cuDNN未能初始化

Python (0)未知:获取卷积算法失败。这可能是因为cuDNN未能初始化,python,jupyter-notebook,syntax-error,faster-rcnn,Python,Jupyter Notebook,Syntax Error,Faster Rcnn,这里我使用mask_rcnn进行目标检测。 代码正常运行,但现在我得到以下错误 代码: Testing - 1 # 1 - 200 images testing # Load a random image from the images folder file_names = next(os.walk(IMAGE_DIR))[2] i=0 for fn in file_names: #image = skimage.io.imread(os.path.join(IMAGE_DIR,

这里我使用mask_rcnn进行目标检测。 代码正常运行,但现在我得到以下错误

代码:

Testing - 1
# 1 - 200 images testing
# Load a random image from the images folder
file_names = next(os.walk(IMAGE_DIR))[2]
i=0


for fn in file_names:

    #image = skimage.io.imread(os.path.join(IMAGE_DIR, random.choice(file_names)))
    i = i+1
    print(i)

    image = skimage.io.imread(os.path.join(IMAGE_DIR, fn))

    # Run detection
    results = model.detect([image], verbose=1)

    # Visualize results
    r = results[0]

    visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'], 
                            class_names, r['scores'])
错误消息:
1 处理1个图像 图像形状:(11231583)最小值:13.00000最大值:255.00000 uint8 模压图像形状:(1、1024、1024、3)最小值:-123.70000最大值:150.10000浮动64 图像图元形状:(1,15)最小值:0.00000最大值:1588.0000064 锚形状:(1261888,4)最小值:-0.35390最大值:1.2932 --------------------------------------------------------------------------- UnknownError回溯(上次最近的调用) 在里面 15 16#运行检测 --->17结果=model.detect([image],verbose=1) 18 19#将结果可视化

D:\gpu\projects1\Mask_RCNN-Multi-Class-Detection\model.py in detect(self, images, verbose)
   2529         # Run object detection
   2530         detections, _, _, mrcnn_mask, _, _, _ =\
-> 2531             self.keras_model.predict([molded_images, image_metas, anchors], verbose=0)
   2532         # Process detections
   2533         results = []

~\Anaconda3\envs\tf-gpu\lib\site-packages\keras\engine\training.py in predict(self, x, batch_size, verbose, steps, callbacks, max_queue_size, workers, use_multiprocessing)
   1399                                             verbose=verbose,
   1400                                             steps=steps,
-> 1401                                             callbacks=callbacks)
   1402 
   1403     def train_on_batch(self, x, y,

~\Anaconda3\envs\tf-gpu\lib\site-packages\keras\engine\training_arrays.py in predict_loop(model, f, ins, batch_size, verbose, steps, callbacks)
    330             batch_logs = {'batch': batch_index, 'size': len(batch_ids)}
    331             callbacks._call_batch_hook('predict', 'begin', batch_index, batch_logs)
--> 332             batch_outs = f(ins_batch)
    333             batch_outs = to_list(batch_outs)
    334             if batch_index == 0:

~\Anaconda3\envs\tf-gpu\lib\site-packages\keras\backend\tensorflow_backend.py in __call__(self, inputs)
   2977                     return self._legacy_call(inputs)
   2978 
-> 2979             return self._call(inputs)
   2980         else:
   2981             if py_any(is_tensor(x) for x in inputs):

~\Anaconda3\envs\tf-gpu\lib\site-packages\keras\backend\tensorflow_backend.py in _call(self, inputs)
   2935             fetched = self._callable_fn(*array_vals, run_metadata=self.run_metadata)
   2936         else:
-> 2937             fetched = self._callable_fn(*array_vals)
   2938         return fetched[:len(self.outputs)]
   2939 

~\Anaconda3\envs\tf-gpu\lib\site-packages\tensorflow\python\client\session.py in __call__(self, *args, **kwargs)
   1456         ret = tf_session.TF_SessionRunCallable(self._session._session,
   1457                                                self._handle, args,
-> 1458                                                run_metadata_ptr)
   1459         if run_metadata:
   1460           proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

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 conv1/convolution}}]]
     [[mrcnn_detection/map/TensorArrayUnstack/range/_4207]]
  (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 conv1/convolution}}]]
0 successful operations.
0 derived errors ignored.

您必须检查是否安装了正确版本的CUDA+CUDNN+TensorFlow(同时确保已安装所有版本)

下面给出了两个运行配置示例

例如,Cuda 10+CuDNN 7.6.3+TensorFlow 1.13/1.14工程

Eg2 Cuda 9+CuDNN 7.0.5+TensorFlow 1.10工程

Eg3 Cuda 10.1+CuDNN 7.6.5+TensorFlow 2.1工程


通常,当您安装了不兼容版本的TensorFlow/CuDNN时,会出现此错误。在我的情况下,当我尝试将较旧的TensorFlow与较新版本的CuDNN一起使用时,会出现此错误。

您必须检查您是否安装了正确版本的CUDA+CuDNN+TensorFlow(同时确保已安装所有版本)

下面给出了两个运行配置示例

例如,Cuda 10+CuDNN 7.6.3+TensorFlow 1.13/1.14工程

Eg2 Cuda 9+CuDNN 7.0.5+TensorFlow 1.10工程

Eg3 Cuda 10.1+CuDNN 7.6.5+TensorFlow 2.1工程


通常,当您安装了不兼容的TensorFlow/CuDNN版本时,会出现此错误。在我的情况下,当我尝试将较旧的TensorFlow与较新版本的CuDNN一起使用时,会出现此错误。

一个救命软件。在安装并重新安装了许多cuda和CuDNN版本后,这是一个有效的版本。如果它对其他人有帮助,我会使用Ubuntu 18.04RTX 2080 super,我安装了Cuda 10+CuDNN 7.6.3+TensorFlow 1.14。您保存了我的项目,非常感谢。一次又一次地感谢@rahuL,我的救生员很高兴。在安装和重新安装了许多Cuda和CuDNN版本后,这是一个有效的版本。如果它对其他人有帮助,我有Ubuntu18.04和RTX 2080 super,我安装了Ubuntu18.04led Cuda 10+CuDNN 7.6.3+TensorFlow 1.14。你救了我的项目,非常感谢。一次又一次地感谢@rahuL,我很高兴