floodsung / LearningToCompare_FSL

PyTorch code for CVPR 2018 paper: Learning to Compare: Relation Network for Few-Shot Learning (Few-Shot Learning part)
MIT License
1.04k stars 267 forks source link

self.train_labels = [labels[self.get_class(x)] for x in self.train_roots] KeyError: '..\\datas\\omniglot_28x28' #47

Open Samlezed opened 2 years ago

Samlezed commented 2 years ago

self.train_labels = [labels[self.get_class(x)] for x in self.train_roots] KeyError: '..\datas\omniglot_28x28'

KhanShovon commented 2 years ago

I'm getting a similar problem. I get KeyError: '(Dataset folder directory)' just like you, for both Omniglot and miniImagenet. Could you solve it? @Samlezed

gaoyangyang-1 commented 1 year ago

i get this error too

gaoyangyang-1 commented 1 year ago

you can change the code like this:

from: task_generator.py, line 74:   def get_class(self, sample): return os.path.join(*sample.split('/')[:-1])

to: def get_class(self, sample): return os.path.join(*sample.split('\')[:-1])

KhanShovon commented 1 year ago

Thank you for your reply. I've solved it following the solution I found on a Chinese forum. That was lifesaving!