2019.5.19 tensorflow报错:Attribute Error: 'NoneType' object has no attribute 'astype' 解决方案
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow

·
几天前在跑模型的时候遇到了这个错误,已经解决,现在补充记录一下。
解决关键:验证数据集中的照片格式是否正确
我出错的原因是数据集中所有的照片虽然都是.jpg格式的,但是有的照片没有进行转码,只是更改了后缀,因此在模型加载的时候才会报错,可以使用PIL工具将所有的jpg图片转换成为jpg图片,从而避免这样的麻烦。
经过2000次的迭代调试之后发现了报错的根源:cv2.imread()
而错误的原因正是因为后缀名和图片的实际格式不符,才会导致imread读入为空
下面是解决的一个小脚本:
# 将所有的图片转换成为jpg格式(防止因为图片格式造成的cv2.imread()异常)
import PIL.Image as Image
import os
def start(Path):
filelist = os.listdir(Path + 'JPEGImages/')
for file in filelist:
img = Image.open(Path + 'JPEGImages/' + file).convert('RGB')
# print(img)
img.save(Path + file)
print('Done!')
解决!




一个面向所有人的开源机器学习框架
最近提交(Master分支:1 个月前 )
4f64a3d5
Instead, check for this case in `ResolveUsers` and `ResolveOperand`, by querying whether the `fused_expression_root` is part of the `HloFusionAdaptor`.
This prevents us from stepping into nested fusions.
PiperOrigin-RevId: 724311958
1 个月前
aa7e952e
Fix a bug in handling negative strides, and add a test case that exposes it.
We can have negative strides that are not just -1, e.g. with a combining
reshape.
PiperOrigin-RevId: 724293790
1 个月前
更多推荐
所有评论(0)