问题描述
笔者的台式机配置如下:
Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 6GB computeCapability: 6.1
笔者安装的CUDA版本如下:
(base) C:\Users\znjt>nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:04_Central_Daylight_Time_2018
Cuda compilation tools, release 10.0, V10.0.130
笔者安装的cudnn版本如下:
打开cmd,进入cuda的安装目录中查看。
cd C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include
cudnn.h
如图所示:笔者的cudnn是7.6.5

笔者在使用object detection 开源项目,对训练好的模型进行测试时,出现如下问题:
说明: 笔者使用tensorflow-gpu=2.3.1
Failed to get convolution algorithm. This is probably because cuDNN failed to initialize
问题解决
(1)首先检查CUDA和cudnn两者的版本的匹配问题:
如上述笔者的CUDA和cudnn版本匹配不存在问题
(2)GPU显存不足,需要对GPU按需分配
在运行的主代码文件中加入如下代码:
import tensorflow as tf
import numpy as np
import keras
config = tf.compat.v1.ConfigProto(allow_soft_placement=True)
config.gpu_options.per_process_gpu_memory_fraction = 0.3
tf.compat.v1.keras.backend.set_session(tf.compat.v1.Session(config=config))
如此可以正常使用GPU进行模型测试
1万+

被折叠的 条评论
为什么被折叠?



