【发布时间】:2020-03-03 13:54:04
【问题描述】:
我正在慢慢学习 Tensorflow,但在将我下载的数据加载到模型中时遇到问题。
不断获得: [Errno 2] 没有这样的文件或目录
文件“数据”包含“火车”和“测试”。 在这些“train”和“test”文件夹中分别包含图像(jpg)。
这个 ipynb 文件创建在与“数据”文件相同的文件夹中。
PATH = os.path.join(os.path.dirname('data'))
train_dir = os.path.join(PATH, 'train')
test_dir = os.path.join(PATH, 'test')
num_train = len(os.listdir(train_dir))
num_test = len(os.listdir(test_dir))
【问题讨论】:
-
您(假设)当前的工作文件夹一定是错误的——但我们看不到您的屏幕,因此很遗憾,除了“再次检查”之外,没有太多建议。检查、验证和确认每一步!另见How to properly determine current script directory?
-
尝试打印出os.getcwd() ^
标签: python-3.x jupyter-notebook tensorflow2.0