天天看点

深度学习框架 TensorFlow 常见问题总结3. Keras VGG16中ValueError: filter must not be larger than the input问题的解决 

1. Check failed: s.ok() could not find cudnnCreate in cudnn DSO; 

  tensorflow/stream_executor/cuda/cuda_dnn.cc:221] Check failed: s.ok() could not find cudnnCreate in cudnn DSO; dlerror: /home/wangxiao/anaconda2/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so: undefined symbol: cudnnCreate

  Aborted

  

  参考了博文:http://blog.csdn.net/jk123vip/article/details/50361951 

  下载了 cudnn-6.5-linux-x64-v2.tgz 并且按照上面说的安装完毕后,发现,原本的错误是没了,但是有了新的错误提示: 

  E tensorflow/stream_executor/cuda/cuda_dnn.cc:378] Loaded runtime CuDNN library: 2000 (compatibility version 2000) but source was compiled with 5105 (compatibility version 5100). If using a binary install, upgrade your CuDNN library to match. If building from sources, make sure the library loaded at runtime matches a compatible version specified during compile configuration.

  F tensorflow/core/kernels/conv_ops.cc:532] Check failed: stream->parent()->GetConvolveAlgorithms(&algorithms)

  又参考博文: http://blog.csdn.net/gongchangsan/article/details/52573254 

  上面提示说是 CUDNN 的版本太低导致的。我呵呵。。。

深度学习框架 TensorFlow 常见问题总结3. Keras VGG16中ValueError: filter must not be larger than the input问题的解决 

  好吧,去安装 cudnn7.5 

  鉴于我自己的 cuda 版本是 8.0,我下载了 cudnn-8.0-linux-x64-v5.1.tgz 安装后,还是这个鬼问题。。。。查了几个博文,都说是 cudnn 版本太低的原因。

  http://blog.csdn.net/gavin__zhou/article/details/52693837

深度学习框架 TensorFlow 常见问题总结3. Keras VGG16中ValueError: filter must not be larger than the input问题的解决 

  心塞啊,难道是没装上 ?  

  2. 如何在 Linux 系统中,只复制文件夹,而不拷贝文件夹内部的文件? 只是文件夹的复制。。。

  答: 可以参考:http://stackoverflow.com/questions/4073969/copy-folder-structure-sans-files-from-one-location-to-another 

    亲测有效:<code>    cd /path/to/directories &amp;&amp;</code>

the solutions are learning from http://blog.csdn.net/u013920434/article/details/53443757

解决方法:

方法一:

假设输入为:

model.add(ZeroPadding2D((1, 1), batch_input_shape=(1, 3, img_width, img_height)))   

<code>将其改为</code><code>:</code>

model.add(ZeroPadding2D((1, 1), batch_input_shape=(1, img_width, img_height, 3)))  

方法二:

在网络层明确指明:<code>image_dim_ordering,</code><code>即输入图像的维度次序</code><code>;</code>

<code>例如加上如下语句</code><code>:</code>

from keras import backend as K  

     if K.image_dim_ordering() == 'th':  

        model.add(ZeroPadding2D((1, 1), batch_input_shape=(1,3,img_width, img_height)))  

     else:  

        model.add(ZeroPadding2D((1, 1), batch_input_shape=(1,img_width, img_height,3)))  

<code>方法三</code><code>:</code><code>修改文件’</code><code>~/.keras/keras.json’</code><code>中的’</code><code>tf</code><code>’</code><code>为’</code><code>th</code><code>’.</code>

<code>Reference:</code>

<code>http://stackoverflow.com/questions/39848466/tensorflow-keras-convolution2d-valueerror-filter-must-not-be-larger-than-t </code>