Tensorflow问题
TypeError: 'urban' has type str, but expected one of: bytes
在前面添加"b"(例如,b'urban'),或者处理为variableName.encode("utf8")
Variable count_var2 already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope?
在开始的地方添加:
tf.reset_default_graph()
File "F:\Program Files\Python\Python36\lib\random.py", line 275, in shuffle
x[i], x[j] = x[j], x[i]
TypeError: 'range' object does not support item assignment
后来定位原因是tfrecord是基于python2写的,里面range返回的list对象,但是再python3里面返回的是range对象。
shuffled_index = range(len(filenames))
random.seed(12345)
random.shuffle(list(shuffled_index))
如此修改,问题解决
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 247: character maps to <undefined>
with open(file=filename, mode="rb") as f:
将mode由"r"转变为"rb"
https://blog.csdn.net/qq_41185868/article/details/82843781
TypeError: 'RGB' has type str, but expected one of: bytes
colorspace = b'RGB'
channels = 3
image_format = b'JPEG' example = tf.train.Example(features=tf.train.Features(feature={
...
'image/colorspace': _bytes_feature(colorspace),
...
'image/format': _bytes_feature(image_format),
...
return example
在colorspace以及image_format中添加了'b',问题解决。
TypeError: 'water' has type str, but expected one of: bytes
def _bytes_feature(value):
"""Wrapper for inserting bytes features into Example proto."""
print("value值是: ", value)
if(type(value) is not bytes):
value = value.encode("utf8")
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def _bytes_feature(value):
"""Wrapper for inserting bytes features into Example proto."""
print("value值是: ", value)
if(type(value) is not bytes):
注意bytes是python3中引入的一个类型;pyton2的时候后,string类型是可以当成byte来处理的,比如传输,但是到了python3时代,bytes和string是严格区分的;所有有了上面这段判断,如果不是bytes需要转换为byte(注意类型判断使用的是"is/ is not";
ValueError: invalid literal for int() with base 10: 'lOOOOO'
argument = "lOOOOOO" argument = int(argument) print("complete")
后来发现那个圈其实是大写的"O"而不是"0"... ... 请问,这一条可以不写吗?后来想明白了原因,我是从PDF中直接粘出来的,PDF是一个根据图片生成的命令,会做一些莫名其妙的转换,发生了0转O的情况。

Tensorflow问题的更多相关文章
- Tensorflow 官方版教程中文版
2015年11月9日,Google发布人工智能系统TensorFlow并宣布开源,同日,极客学院组织在线TensorFlow中文文档翻译.一个月后,30章文档全部翻译校对完成,上线并提供电子书下载,该 ...
- tensorflow学习笔记二:入门基础
TensorFlow用张量这种数据结构来表示所有的数据.用一阶张量来表示向量,如:v = [1.2, 2.3, 3.5] ,如二阶张量表示矩阵,如:m = [[1, 2, 3], [4, 5, 6], ...
- 用Tensorflow让神经网络自动创造音乐
#————————————————————————本文禁止转载,禁止用于各类讲座及ppt中,违者必究————————————————————————# 前几天看到一个有意思的分享,大意是讲如何用Ten ...
- tensorflow 一些好的blog链接和tensorflow gpu版本安装
pading :SAME,VALID 区别 http://blog.csdn.net/mao_xiao_feng/article/details/53444333 tensorflow实现的各种算法 ...
- tensorflow中的基本概念
本文是在阅读官方文档后的一些个人理解. 官方文档地址:https://www.tensorflow.org/versions/r0.12/get_started/basic_usage.html#ba ...
- kubernetes&tensorflow
谷歌内部--Borg Google Brain跑在数十万台机器上 谷歌电商商品分类深度学习模型跑在1000+台机器上 谷歌外部--Kubernetes(https://github.com/kuber ...
- tensorflow学习
tensorflow安装时遇到gcc: error trying to exec 'as': execvp: No such file or directory. 截止到2016年11月13号,源码编 ...
- 【转】TensorFlow练习20: 使用深度学习破解字符验证码
验证码是根据随机字符生成一幅图片,然后在图片中加入干扰象素,用户必须手动填入,防止有人利用机器人自动批量注册.灌水.发垃圾广告等等 . 验证码的作用是验证用户是真人还是机器人:设计理念是对人友好,对机 ...
- 【转】机器学习教程 十四-利用tensorflow做手写数字识别
模式识别领域应用机器学习的场景非常多,手写识别就是其中一种,最简单的数字识别是一个多类分类问题,我们借这个多类分类问题来介绍一下google最新开源的tensorflow框架,后面深度学习的内容都会基 ...
- 【转】Ubuntu 16.04安装配置TensorFlow GPU版本
之前摸爬滚打总是各种坑,今天参考这篇文章终于解决了,甚是鸡冻\(≧▽≦)/,电脑不知道怎么的,安装不了16.04,就安装15.10再升级到16.04 requirements: Ubuntu 16.0 ...
随机推荐
- Python入门篇-文件操作
Python入门篇-文件操作 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.文件IO常用操作 open:打开 read:读取 write:写入 close:关闭 readlin ...
- memcached——学习
文章:memcached 常用命令及使用说明 远程清除memcached缓存 使用命令行: telnet 127.0.0.1 11211 连上memcached 然后使用命令:flush_all ...
- Codeforces G. Ciel the Commander
题目描述: Ciel the Commander time limit per test 1 second memory limit per test 256 megabytes input stan ...
- Codeforces D. Little Elephant and Interval(思维找规律数位dp)
题目描述: Little Elephant and Interval time limit per test 2 seconds memory limit per test 256 megabytes ...
- 次小生成树(lca)
题目描述 原题来自:BeiJing 2010 组队赛 给定一张 N 个点 M 条边的无向图,求无向图的严格次小生成树. 设最小生成树的边权之和为 sum,严格次小生成树就是指边权之和大于 sum 的生 ...
- AOP_原理
什么是AOPAOP(Aspect-OrientedProgramming,面向方面编程),可以说是OOP(Object-Oriented Programing,面向对象编程)的补充和完善.OOP引入封 ...
- Basic concepts of docker/kubernete/kata-container
Kubereters An open-source system for automating deployment, scaling, and management of containerized ...
- 如何把上传图片时候的文件对象转换为图片的url !
getObjectURL(file) { var url = null; if (window.createObjectURL != undefined) { url = window.createO ...
- zabbix server内存突然飙升
2019年10月16日22:20:58 十点二十突然内存占满,top查询一个httpd进程占了79%,查询httpd.error.log发现 [Wed Oct 16 10:24:57.578643 2 ...
- 洛谷 P3371 【模板】单源最短路径(弱化版) 题解
P3371 [模板]单源最短路径(弱化版) 题目背景 本题测试数据为随机数据,在考试中可能会出现构造数据让SPFA不通过,如有需要请移步 P4779. 题目描述 如题,给出一个有向图,请输出从某一点出 ...