一、查看版本:

进入到Python的命令行状态后,可以在终端输入查询命令如下:

import tensorflow
tensorflow.__version__

查询tensorflow安装路径为:

tensorflow.__path__

二、cuDNN无法使用

Loaded runtime CuDNN library: 7.0. but source was compiled with: 7.1..  CuDNN library major and minor version needs to match or have higher minor version in case of CuDNN 7.0 or later version. If using a binary install, upgrade your CuDNN library.  If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.

我的开发环境是

ubuntu18.
cuda9.
cudnn7.
tensorflow 1.12.
python 3.6

发现错误原因是TensorFlow的版本太高了。

解決的方法是把tensorflow降到和我cudnn匹配的版本:

pip3 install --upgrade --force-reinstall tensorflow-gpu==1.9.

三.出现No module named 'object_detection' 的错误

File "object_detection/builders/model_builder_test.py", line , in <module>     
    from object_detection.builders import model_builder Module
NotFoundError: No module named 'object_detection'

这个是上一步的slim的导入路径问题,应该使用slim的绝对路径:

export PYTHONPATH="$PYTHONPATH:/home/user/models/research/slim"

四、AttributeError:'module' object has no attribute 'mul'

原因:TensorFlow 发布的新版本的 API 修改了

tf.mul, tf.sub and tf.neg are deprecated in favor of tf.multiply, tf.subtract and tf.negative.

解决方法:使用时将 tf.mul 改成 tf.multiply 即可,其余的 tf.sub 和 tf.neg 也要相应修改为 tf.subtract 和 tf.negative。

五、SyntaxError: invalid syntax

print "Epoch {0}: {1} / {2}".format(
                                      ^
SyntaxError: invalid syntax

Python3中print函数需要加括号。

六、Dst tensor is not initialized

原因:GPU显存满了。

解决方法:如果是使用Jupyter,就把别的运行的Jupyter程序关了。

七、numpy的版本更换

每次运行代码都会出现这个警告,其实就是numpy的版本比较高

/home/eason/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/eason/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/eason/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/eason/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/eason/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/eason/.local/lib/python3.5/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])

先卸载numpy:

pip3 uninstall numpy

再安装,只要在1.17版本以下都可以

pip3 install numpy==1.16

八、ImportError: No module named '_tkinter'

解决方法:

sudo apt-get install python3-tk

  

使用TensorFlow遇到的若干问题的更多相关文章

  1. 学习笔记TF049:TensorFlow 模型存储加载、队列线程、加载数据、自定义操作

    生成检查点文件(chekpoint file),扩展名.ckpt,tf.train.Saver对象调用Saver.save()生成.包含权重和其他程序定义变量,不包含图结构.另一程序使用,需要重新创建 ...

  2. Tensorflow之MNIST解析

    要说2017年什么技术最火爆,无疑是google领衔的深度学习开源框架Tensorflow.本文简述一下深度学习的入门例子MNIST. 深度学习简单介绍 首先要简单区别几个概念:人工智能,机器学习,深 ...

  3. Android Things 专题6 完整的栗子:运用TensorFlow解析图像

    文| 谷歌开发技术专家 (GDE) 王玉成 (York Wang) 前面絮叨了这么多.好像还没有一个整体的概念.我们怎样写一个完整的代码呢? 如今深度学习非常火,那我们就在Android Things ...

  4. TensorFlow 基础知识

    参考资料: 深度学习笔记目录 向机器智能的TensorFlow实践 TensorFlow机器学习实战指南 Nick的博客 TensorFlow 采用数据流图进行数值计算.节点代表计算图中的数学操作,计 ...

  5. Keras:基于Theano和TensorFlow的深度学习库

    catalogue . 引言 . 一些基本概念 . Sequential模型 . 泛型模型 . 常用层 . 卷积层 . 池化层 . 递归层Recurrent . 嵌入层 Embedding 1. 引言 ...

  6. 使用TensorFlow的卷积神经网络识别自己的单个手写数字,填坑总结

    折腾了几天,爬了大大小小若干的坑,特记录如下.代码在最后面. 环境: Python3.6.4 + TensorFlow 1.5.1 + Win7 64位 + I5 3570 CPU 方法: 先用MNI ...

  7. anaconda 环境新建/删除/拷贝 jupyter notebook上使用python虚拟环境 TensorFlow

    naconda修改国内镜像源 国外网络有时太慢,可以通过配置把下载源改为国内的通过 conda config 命令生成配置文件,这里使用清华的镜像: https://mirrors.tuna.tsin ...

  8. Tensorflow模型的格式

    转载:https://cloud.tencent.com/developer/article/1009979 tensorflow模型的格式通常支持多种,主要有CheckPoint(*.ckpt).G ...

  9. 基于 TensorFlow 在手机端实现文档检测

    作者:冯牮 前言 本文不是神经网络或机器学习的入门教学,而是通过一个真实的产品案例,展示了在手机客户端上运行一个神经网络的关键技术点 在卷积神经网络适用的领域里,已经出现了一些很经典的图像分类网络,比 ...

随机推荐

  1. [bzoj1717][Milk Patterns 产奶的模式]

    题目链接 思路 先求出后缀数组,并且求出LCP.二分一下长度len.check的时候就是看有没有连续的k个后缀的LCP大于len.也就是判断是不是有连续的k-1个height大于len. 代码 #in ...

  2. echarts图Y周坐标轴文字过长的解决方案

    解决方案  只贴出关键代码 在翻看echarts文档的过程中我看到了坐标轴文字可以自行定义模板,于是想到了我给一个固定12的字数限制,超出部分以省略号代替,这样就不会造成图形范围忽大忽小了. axis ...

  3. Luogu P4015 运输问题

    题目链接 \(Click\) \(Here\) 继续颓网络流\(hhhhh\),虽然这次写的是个大水题,但是早上水一个网络流果然还是让人心情舒畅啊- 最大费用最大流不用非得反着费用建边.只要没有正环, ...

  4. Vue(基础七)_webpack(webpack异步加载原理)

    ---恢复内容开始--- 一.前言 1.webpack异步加载原理’                                           2.webpack.ensure原理     ...

  5. hibernate的学习周

    Hibernate核心:ORM(对象关系映射) BeginSession关闭的时候要session.close(),而getCurrentsession不需要,它会自动关闭 Session.load( ...

  6. Yearning 介绍(SQL审核平台)

    介绍 Yearning SQL 审计平台 基于Vue.js与Django的整套mysql-sql审核平台解决方案.提供基于Inception的SQL检测及执行. GitHub:https://gith ...

  7. TCP详解——连接建立与断开

    一.报文结构介绍 在开始讲TCP连接过程时,还是先看看TCP报文的格式如图1所示.IP数据报此时由IP头部+TCP头部+TCP数据组成.不带选项的TCP头部是20字节长,而带选项的,TCP头部最长可达 ...

  8. ELK 安装与基本配置(一)

    对于日志来说,最常见的需求就是收集.存储.查询.展示,开源社区正好有相对应的开源项目:logstash(收集).elasticsearch(存储+搜索).kibana(展示),我们将这三个组合起来的技 ...

  9. Hadoop生态圈-构建企业级平台安全方案

    Hadoop生态圈-构建企业级平台安全方案 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 能看到这篇文章的小伙伴,估计你对大数据集群的部署对于你来说应该是手到擒来了吧.我之前分享过 ...

  10. 网络编程基础【day10】:多线程效果演示(二)

    本节内容 1.引子 2.并发多线程效果演示 一.引子 我们说单核的cpu只能同时执行一个任务,但是给我们的一个幻觉是可以执行多个,因为cpu太快了.它是怎么实现的呢?就是上下文切换,它不是轮询着切换的 ...