tim-learn / SHOT

code released for our ICML 2020 paper "Do We Really Need to Access the Source Data? Source Hypothesis Transfer for Unsupervised Domain Adaptation"
MIT License
437 stars 78 forks source link

Reproduce Digital #17

Closed ygjwd12345 closed 3 years ago

ygjwd12345 commented 3 years ago

When I rerun digital, python uda_digit.py --dset u2m --gpu_id 1 --cls_par 0.1 --output ckps_digits; The error happes as follow: Traceback (most recent call last): File "uda_digit.py", line 180, in train_source inputs_source, labels_source = iter_source.next() UnboundLocalError: local variable 'iter_source' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "uda_digit.py", line 453, in train_source(args) File "uda_digit.py", line 183, in train_source inputs_source, labels_source = iter_source.next() File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data return self._process_data(data) File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data data.reraise() File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/_utils.py", line 394, in reraise raise self.exc_type(msg) TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "uda_digit.py", line 180, in train_source inputs_source, labels_source = iter_source.next() UnboundLocalError: local variable 'iter_source' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/data2/gyang/DA-transformer-other/digit/data_load/usps.py", line 71, in getitem img = self.transform(img) File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 70, in call img = t(img) File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 1003, in call return F.rotate(img, angle, self.resample, self.expand, self.center, self.fill) File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 729, in rotate return img.rotate(angle, resample, expand, center, fillcolor=fill) File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/PIL/Image.py", line 2023, in rotate return self.transform((w, h), AFFINE, matrix, resample, fillcolor=fillcolor) File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/PIL/Image.py", line 2337, in transform im = new(self.mode, size, fillcolor) File "/home/gyang/anaconda3/envs/pytorch/lib/python3.6/site-packages/PIL/Image.py", line 2544, in new return im._new(core.fill(mode, size, color)) TypeError: function takes exactly 1 argument (3 given)

ygjwd12345 commented 3 years ago

Only u2m

tim-learn commented 3 years ago

Only u2m

can you check the existence of downloaded data in the ./data/usps ?

ygjwd12345 commented 3 years ago

截屏2021-04-09 上午11 03 08

ygjwd12345 commented 3 years ago

Only u2m

can you check the existence of downloaded data in the ./data/usps ?

Is it right?

tim-learn commented 3 years ago

Only u2m

can you check the existence of downloaded data in the ./data/usps ?

Is it right?

Maybe you need to debug by yourself, I never meet such a problem.

ygjwd12345 commented 3 years ago

Only u2m

can you check the existence of downloaded data in the ./data/usps ?

Is it right?

Maybe you need to debug by yourself, I never meet such a problem. My data tree is right or not?

tim-learn commented 3 years ago

Only u2m

can you check the existence of downloaded data in the ./data/usps ?

Is it right?

Maybe you need to debug by yourself, I never meet such a problem. My data tree is right or not?

it seems okay

ygjwd12345 commented 3 years ago

I solve the problem by changing transforms.RandomRotation(10), to transforms.RandomRotation(10, fill=(0,)),