TensorFlow的安装与CNN测试

0.说明

在Google开源该框架之后便使用真实K40m卡测试,由于生产环境是CentOS6.6的操作系统,但是该框架需要在Python2.7环境下执行,CentOS6.6下折腾了一天没搞定,后来换成CentOS7,顺利跑通

1.系统环境

  • python >=2.7
  • numpy >=1.9
  • gcc >=4.8.2
  • cuda 7.0
  • java >=1.8
  • cudnn 6.5 v2

2.安装部署

 
  1. #安装依赖,kernel-devel是为了安装cuda
  2. yum -y install gcc python-devel kernel-devel
  3. #安装pip
  4. wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
  5. tar zvxf 1.5.5.tar.gz
  6. cd pip-1.5.5/
  7. python setup.py install
  8. #安装tensorflow,此时确保服务器可以联网,会自动下载安装numpy和six
  9. pip install http://dlp.iflytek.com/soft/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

3.测试用例CNN

  • 下载训练数据集
 
  1. wget http://dlp.iflytek.com/soft/cifar-10-binary.tar.gz
  2. tar -zxvf -C /tmp/cifar10_data
  • 执行脚本(默认cpu) 
    cd /root/tensorflow-master/tensorflow/models/image/cifar10 
    python cifar10_train.py 
    单卡

  • 采用gpu执行 
    python cifar10_multi_gpu_train.py --num_gpus=4 
    多卡

4.脚本相关说明

 
  1. #查看帮助
  2. python cifar10_train.py --help
  3. --batch_size BATCH_SIZE #一批数据的图片数量,默认是包含128个examples
  4. Number of images to process in a batch.
  5. --data_dir DATA_DIR #训练数据集目录,默认是/tmp/cifar10_data
  6. Path to the CIFAR-10 data directory.
  7. --train_dir TRAIN_DIR #训练目录
  8. Directory where to write event logs and checkpoint.
  9. --max_steps MAX_STEPS #最大步数,默认是1000000
  10. Number of batches to run.
  11. --log_device_placement LOG_DEVICE_PLACEMENT
  12. Whether to log device placement.
  13. --nolog_device_placement
 

Tutorials and Machine Learning Examples — TensorFlow 
http://tensorflow.org/tutorials/deep_cnn/index.md

posted @ 2015-11-11 22:19  茗迹周  阅读(9420)  评论(0编辑  收藏  举报