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 ...
随机推荐
- CodeCombat第一关:KITHGARD地牢之KITHGARD精通
https://www.cnblogs.com/OctoptusLian/p/7397602.html https://www.jianshu.com/p/065581a84879 https://w ...
- 微信小程序-数组操作
Page({ data: { list:[{ id:, name:'芒果', count: },{ id:, name:'香蕉', count: }, }] } }) 向前插入数据 //要增加的数组 ...
- WPF 控件库——带有惯性的ScrollViewer*(转)
转:https://blog.csdn.net/ahilll/article/details/82418892 一.先看看效果 二.原理 虽然效果很简单,但是网上的一些资料涉及的代码量非常可观,而且效 ...
- 大数据开发keras框架环境配置小结
系统安装问题 win10+ubuntu16.04 在win10在需要security boot设置成disable,否则安装完后无法设置启动项. 安装完ubuntu重启,系统会直接进入win10,需要 ...
- centos7部署postgresql集群高可用 patroni + etcd 之patroni篇
实验环境:centos7.4纯净版 postgres版本: 9.6.15 etcd版本:3.3.11 patroni版本:1.6.0 patroni介绍可参考:https://github.com/z ...
- 【比赛题解】CSP2019 简要题解
D1T1 code 签到题,大家都会. 可以从高位往低位确定,如果遇到 \(1\),则将排名取反一下. 注意要开 unsigned long long. #include <bits/stdc+ ...
- Sliding Window Matrix Maximum
Description Given an array of n * m matrix, and a moving matrix window (size k * k), move the window ...
- Wiki with Herbal Medicine
Problem H. Wiki with Herbal MedicineInput file: standard input Time limit: 1 secondOutput file: stan ...
- 学习Spring-Data-Jpa(十七)---对Web模块的支持
Spring-Data还提供了Web模块的支持,这要求Web组件Spring-MVC的jar包位于classpath下.通常通过使用@EnableSpringDataWebSupport注解来启用继承 ...
- 开源项目 08 IOC Autofac
using Autofac; using System; using System.Collections.Generic; using System.Linq; using System.Text; ...