首页 > 解决方案 > 在 Chainer 模型中仅提供图像

问题描述

我有一个仅包含图像的数据集,这些图像将在自动编码器中用于重新生成输入图像。我想使用链接器 ImageDataset 将数据输入迭代器。

data = test_tup = chainer.datasets.ImageDataset('/NewText.txt', '/train')

我已经给出了包含图像地址的文本文件的地址,并在根目录中给出了保存图像的文件夹的地址。

 79         _check_pillow_availability()
 80         if isinstance(paths, six.string_types):
---> 81             with open(paths) as paths_file:
 82                 paths = [path.strip() for path in paths_file]
 83         self._paths = paths

FileNotFoundError: [Errno 2] No such file or directory: '/NewText.txt'

这是使用 ImageDataset 的正确方法吗?另外我想知道 ImageDataset 是否是仅输入图像的好选择,还是有其他选择。

标签: image-processingdatasetchainer

解决方案


我猜路径可能与您的预期不同。print(paths)可能有助于确定问题。

datasets.LabeledImageDataset() 可能会更好。有关导入的示例,请查看此处:https ://github.com/chainer/chainer/blob/v5.4.0/examples/imagenet/train_imagenet.py

希望有帮助,


推荐阅读