Python3
又酸又菜又多余的菜
这个作者很懒,什么都没留下…
展开
-
TypeError: expected bytes, Example found
tensorflow在写入tfrcords文件时,报错:TypeError: expected bytes, Example found注意:字符串为一个序列化的Example,Example.SerializeToString()所以代码应为:file.write(example.SerializeToString())...原创 2019-10-21 16:24:58 · 430 阅读 · 0 评论 -
TypeError: No positional arguments allowed
tensorflow将图片信息写入tfrecords文件时,报错如下:TypeError: No positional arguments allowed原因:tf.train.Features要求按关键字/参数对传递解决方法:按以下格式传递example = tf.train.Example(features=tf.train.Features(feature=f...原创 2019-10-21 16:22:43 · 4221 阅读 · 1 评论 -
AttributeError: __enter__
tensorflow报错如下with tf.Session as sess:AttributeError: __enter__解决方法:with tf.Session()as sess:如上所示,错误原因为忘记在Session后加()原创 2019-10-21 16:12:50 · 1927 阅读 · 0 评论 -
sys.stdout.write刷新进度条的问题
sys.stdout.write( " 已下载:%.3f%%" % float(i / ss.nums) + “\r”)显示无进度条解决方法:sys.stdout.write(’\r’ + " 已下载:%.3f%%" % float(i / ss.nums))原创 2019-04-02 11:16:41 · 799 阅读 · 0 评论 -
setuptools pip wheel failed with error code 2
使用mkvirualenv创建环境报错setuptools pip wheel failed with error code 2尝试更新setuptools版本,命令如下pip install --upgrade setuptools再次执行mkvirualenv ml问题解决!顺便还更新了下pip的版本python -m pip install...原创 2019-07-31 15:06:14 · 4039 阅读 · 2 评论 -
Found input variables with inconsistent numbers of samples
mean_squared_error(y_true, y_predict)报错:Found input variables with inconsistent numbers of samples原因:y_true和y_predict行数不一致问题y_true.shapey_predict.shape查看真实值和预测值的形状...原创 2019-09-26 14:24:03 · 44340 阅读 · 7 评论 -
module 'tensorflow' has no attribute 'Session'
默认安装了TensorFlow2.0,tf.Session(),报错module 'tensorflow' has no attribute 'Session'原因是2.0,要将tf.Session改为tf.compat.v1.Session()原创 2019-10-09 15:42:25 · 251 阅读 · 0 评论