gidariss / FewShotWithoutForgetting

MIT License
519 stars 110 forks source link

UnicodeDecodeError when training #20

Closed zjxi closed 5 years ago

EternalWang commented 5 years ago

When I run the 1st training stage :

CUDA_VISIBLE_DEVICES=0 python train.py --config=miniImageNet_Conv128CosineClassifier

But it comes to an error like this :

Traceback (most recent call last):
  File "train.py", line 72, in <module>
    dataset_train = MiniImageNet(phase=train_split)
  File "C:\Users\lenovo\Desktop\FewShotWithoutForgetting\dataloader.py", line 122, in __init__
    data_train = load_data(file_train_categories_train_phase)
  File "C:\Users\lenovo\Desktop\FewShotWithoutForgetting\dataloader.py", line 90, in load_data
    data = pickle.load(fo)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x91 in position 1: ordinal not in range(128)

Environment Python 3.7, pytorch 0.4 Thanks.

Hello, have you fixed this problem?

EternalWang commented 5 years ago

Thanks a lot! Maybe we can work on it together.

EternalWang commented 5 years ago

However, when using the ‘bytes’ encoding rule, I met another problem below:

Traceback (most recent call last):
  File "train.py", line 72, in <module>
    dataset_train = MiniImageNet(phase=train_split)
  File "/media/eternal-wang/D/Research/FSL/FewShotWithoutForgetting-master/dataloader.py", line 124, in __init__
    self.data = data_train['data']
KeyError: 'data'

But after changed into ‘iso-8859-1’,the problem disappeared.

EternalWang commented 5 years ago

Yes. By the way, I finally make the code running after fixed several bugs.

EternalWang commented 5 years ago

I haven't met this error. Maybe you should check the path of ./architectures/ConvNet.py

EternalWang commented 5 years ago

change

self.global_iter = self.curr_epoch * len(data_loader) + self.biter

to

self.global_iter = self.curr_epoch * len(data_loader()) + self.biter

EternalWang commented 5 years ago

change

nEvalExamplesPerClass = nTestNovel / nKnovel

to

nEvalExamplesPerClass = int(nTestNovel / nKnovel)

in dataloader.py at line 380

EternalWang commented 5 years ago

你已经是个成熟的程序员了,应该学会开动小脑瓜自己debug了。