orobix / Prototypical-Networks-for-Few-shot-Learning-PyTorch

Implementation of Prototypical Networks for Few Shot Learning (https://arxiv.org/abs/1703.05175) in Pytorch
MIT License
986 stars 210 forks source link

FileNotFoundError #29

Open zhougoodman opened 3 years ago

zhougoodman commented 3 years ago

FileNotFoundError Traceback (most recent call last)

in 252 253 if __name__ == '__main__': --> 254 main() in main() 208 init_seed(options) 209 --> 210 tr_dataloader = init_dataloader(options, 'train') 211 val_dataloader = init_dataloader(options, 'val') 212 # trainval_dataloader = init_dataloader(options, 'trainval') in init_dataloader(opt, mode) 47 48 def init_dataloader(opt, mode): ---> 49 dataset = init_dataset(opt, mode) 50 sampler = init_sampler(opt, dataset.y, mode) 51 dataloader = torch.utils.data.DataLoader(dataset, batch_sampler=sampler) in init_dataset(opt, mode) 23 24 def init_dataset(opt, mode): ---> 25 dataset = OmniglotDataset(mode=mode, root=opt.dataset_root) 26 n_classes = len(np.unique(dataset.y)) 27 if n_classes < opt.classes_per_it_tr or n_classes < opt.classes_per_it_val: E:\学习\jupyter\prototypical net\Prototypical-Networks-for-Few-shot-Learning-PyTorch-master\src\omniglot_dataset.py in __init__(self, mode, root, transform, target_transform, download) 53 raise RuntimeError( 54 'Dataset not found. You can use download=True to download it') ---> 55 self.classes = get_current_classes(os.path.join( 56 self.root, self.splits_folder, mode + '.txt')) 57 self.all_items = find_items(os.path.join( E:\学习\jupyter\prototypical net\Prototypical-Networks-for-Few-shot-Learning-PyTorch-master\src\omniglot_dataset.py in get_current_classes(fname) 159 160 def get_current_classes(fname): --> 161 with open(fname) as f: 162 classes = f.read().replace('/', os.sep).splitlines() 163 return classes FileNotFoundError: [Errno 2] No such file or directory: '..\\dataset\\splits\\vinyals\\train.txt'
whisper0055 commented 2 years ago

I think something went wrong when you download the dataset

han-skai commented 1 year ago

image 把需要的文件下载下来(可以直接去代码中给出的url网页上下载,下载4个txt文件和两个zip文件),手动解压后 形成如上文件目录就可以直接运行了。