Python 官方文档:入门教程 => 点击学习
在用PyCharm运行深度神经网络加载数据时,发现报错 Traceback (most recent call last): File “D:/PyCharmWorkPlace/graduate_pr
在用PyCharm运行深度神经网络加载数据时,发现报错
Traceback (most recent call last):
File “D:/PyCharmWorkPlace/graduate_project/lsgan/main.py”, line 16, in
class LSGAN:
File “D:/PyCharmWorkPlace/graduate_project/lsgan/main.py”, line 125, in LSGAN
dataset = dset.ImageFolder(root=dataroot,
File “D:\welcomeminiconda\envs\Tensorflow\lib\site-packages\torchvision\datasets\folder.py”, line 310, in init
super().init(
File “D:\welcomeminiconda\envs\tensorflow\lib\site-packages\torchvision\datasets\folder.py”, line 145, in init
classes, class_to_idx = self.find_classes(self.root)
File “D:\welcomeminiconda\envs\tensorflow\lib\site-packages\torchvision\datasets\folder.py”, line 219, in find_classes
return find_classes(directory)
File “D:\welcomeminiconda\envs\tensorflow\lib\site-packages\torchvision\datasets\folder.py”, line 43, in find_classes
raise FileNotFoundError(f"Couldn’t find any class folder in {directory}.")
FileNotFoundError: Couldn’t find any class folder in D:/PyCharmWorkPlace/graduate_project/data/graydata/.
这里的原因是ImageFolder调用的是一个数据包
我的png文件路径是D:/PyCharmWorkPlace/graduate_project/data/graydata/.
此时应该把路径写为图片的上一级目录,所以添加一个文件夹,将路径改为
D:/PyCharmWorkPlace/graduate_project/data/gray/
问题解决!
来源地址:https://blog.csdn.net/weixin_44906810/article/details/130026001
--结束END--
本文标题: 解决raise FileNotFoundError(f“Couldn’t find any class folder in {directory}.“) FileNotFoundError: Coul
本文链接: https://lsjlt.com/news/392358.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0