关于CNN的一些疑问总结



Introduce
很早就听说CNN这个硬骨头,但始终没有尝试去啃,更别说消化吸收和转化了!昨天尝试了CNN初探例程——MNIST,虽然有不少收获,但还有很多疑问,这里进行整理和统一解答,以便以后再看。
Q&A
1、如何计算卷积和池化后特征维度?


2、如何识别Tensorflow正在使用CPU还是GPU?
答:
1、运行MNIST程序,下载鲁大师或者GPU-z查看GPU占用率,若变高则说明在使用GPU加速,若CPU飙升说明使用CPU!
【关于CNN的一些疑问总结】2、http://blog.csdn.net/fireflychh/article/details/73825851
在cmd-python下运行如下程序:

import tensorflow as tf a = tf.constant([1.,2.,3.,4.,5.,6.], shape=[2,3], name='a') b = tf.constant([1.,2.,3.,4.,5.,6.], shape=[3,2], name='b') c = tf.matmul(a,b)with tf.Session(config= tf.ConfigProto(log_device_placement=True)) as sess: print(sess.run(c))


如果是下图则说明是CPU加速:
关于CNN的一些疑问总结
文章图片


如果是下图则说明是GPU加速:
关于CNN的一些疑问总结
文章图片




3、为何程序中加入with tf.device("/gpu:0"): 这个语句,GPU占有率依然很低,CPU占用率特别高?
答:
因为程序本身没有使用GPU加速,或者没有GPU加速环境,或者没有安装CUDA和CUDNN。
4、如何搭建GPU加速环境?
答:
CUDA在国内基本上下不下来,这里是我分享的网盘:
CUDNN需要自己动手试试了
windows下如何完成GPU环境配置可以参考:
总结如下:
1.设置好GPU开发环境,安装cuda8.0和cudnn5.1
2.安装Anaconda3-4.3.1-Windows-x86_64,默认Python版本为3.6
3.安装完以后,打开Anaconda Prompt,输入清华的仓库镜像,更新包更快:
conda config --add channelshttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
4.建立TensorFlow空间:conda create -n tensorflow python=3.5,设置Python版本为3.5
5.激活TensorFlow空间:activate tensorflow
6.安装TensorFlow:pip install--ignore-installed --upgrade tensorflow_gpu-1.0.0-cp35-cp35m-win_amd64.whl
7.测试TensorFlow:
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))


其中的坑:CUDA的安装等
http://m.blog.csdn.net/infovisthinker/article/details/54705826
http://blog.csdn.net/weixin_36368407/article/details/54177380
https://jingyan.baidu.com/article/b24f6c821a2f8b86bfe5da19.html
http://tieba.baidu.com/p/4863121783

5、Tensorflow运行机制?


6、卷积神经网络基本原理?
7、卷积神经网络经典结构有哪些?为什么这么有效?



8、卷积神经网络如何调参?

9、还有没有其他方法搭建CNN网络?
解答待续。。。



    推荐阅读