zoukankan      html  css  js  c++  java
  • 虚拟环境+tensorflow-gpu

    这么简单的环境配置搞了三天,圈内Bug太多,缺少DLL等一系列问题。总结一下,希望网友们少走弯路,亲测有效。

    环境:anaconda2020.02,tensorflow-gpu:1.8.0,python3.6,cuda9.0(听说就是因为cuda是10.0以上版本pip的tensorflow-gpu会有bug),cudnn,keras2.1.6,protobuf==3.6.0,labelme=3.16.2

    环境及期间遇到问题下载的东西都在下方链接,pip和.condarc文件放在:C:Users用户文件下:

    链接:https://pan.baidu.com/s/1ioQYh4wDdDI_zF5VTeb1_Q
    提取码:qbzb

    1.cuda_9的exe文件进行安装(选自定义),一路next,安装完毕:C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.0

    2.Cudnn解压,把内容复制到C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.0

    2.2添加路径:用户变量增加:C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.0

    系统变量增加:

    3.conda create -n tf-gpu python=3.6 #创建3.6的python虚拟环境

    4.activate tf-gpu#激活此虚拟环镜

    5.pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu==1.8.0#装此版本的tfgpu

    5.1在D:Softwaresanaconda3etcprofile.d的script文件的末尾增加:

    
    export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
    
    export PATH=/usr/local/cuda-9.0/bin:/usr/local/cuda/bin:$PATH
    

     

    6.验证:

    import numpy
    import tensorflow as tf
    with tf.device('/gpu:0'):
    a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a',dtype=tf.float32)
    b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b',dtype=tf.float32)
    c = tf.matmul(a, b)
    sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
    print(sess.run(c))

    ok,终于成功,难得五月的我还在家,虽然不上学,但假期总要有仪式感,该出去浪的时候就不能犹豫,哈哈哈哈哈哈,放假总是开心的。

    7.tensorboard使用时老是打开空白页:不用换目录,地址用双斜杠,tensorboard --logdir=D:\vgg_seg_net\model完美解决

  • 相关阅读:
    图像检索(image retrieval)- 11
    图像检索(image retrieval)- 10相关
    Mock.js简易教程,脱离后端独立开发,实现增删改查功能
    Azure Monitor (3) 对虚拟机磁盘设置自定义监控
    Azure Monitor (1) 概述
    Azure SQL Managed Instance (2) 备份SQL MI
    Azure Virtual Network (17) Private Link演示
    Azure Virtual Network (16) Private Link
    Azure Virtual Network (15) Service Endpoint演示
    Azure Virtual Network (14) Service Endpoint服务终结点
  • 原文地址:https://www.cnblogs.com/Turing-dz/p/12807270.html
Copyright © 2011-2022 走看看