Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

训练时报错:AttributeError: 'NoneType' object has no attribute 'shape' #23

Open
Wangyy-moya opened this issue Aug 13, 2020 · 3 comments

Comments

@Wangyy-moya
Copy link

Wangyy-moya commented Aug 13, 2020

训练时,报下面的错误,请问怎么解决?

Traceback (most recent call last):
File "train.py", line 174, in
main()
File "train.py", line 170, in main
train.start_train()
File "train.py", line 148, in start_train
X_train, X_test, y_train, y_test=self.load_data()
File "train.py", line 55, in load_data
_, w, h = img.shape[::-1]
AttributeError: 'NoneType' object has no attribute 'shape'

@Wangyy-moya
Copy link
Author

试了几个模型训练,都是报这个错,图像路径正确的,每次读取训练照片的进度条也不一样
image
最高一次到96%就断掉

@Wangyy-moya
Copy link
Author

我解决了

我出错的原因是数据集中有的照片没有进行转码,只是更改了后缀,所以在模型加载的时候会报错,用PIL工具将所有的jpg图片转换成为jpg图片就可以了(png格式的照片也是这样操作)。

@itismeJH
Copy link

itismeJH commented Aug 13, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants