YuvalNirkin / hyperseg

HyperSeg - Official PyTorch Implementation
https://nirkin.com/hyperseg
Creative Commons Zero v1.0 Universal
210 stars 39 forks source link

ValueError: Unknown resampling filter (InterpolationMode.BICUBIC). #17

Closed JoyeeZhang closed 2 years ago

JoyeeZhang commented 2 years ago

I have some problems when I train the model on my own data and I don't know if it is because that I make some mistakes when I load my data. Here are the details: Traceback (most recent call last): File "E:\zjy\hyperseg-main\hyperseg\train.py", line 254, in main epoch_loss, epoch_iou = proces_epoch(val_loader, train=False) File "E:\zjy\hyperseg-main\hyperseg\train.py", line 104, in proces_epoch for i, (input, target) in enumerate(pbar): File "E:\anaconda3\envs\zhangjiaying\lib\site-packages\tqdm\std.py", line 1130, in iter for obj in iterable: File "E:\anaconda3\envs\zhangjiaying\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next data = self._next_data() File "E:\anaconda3\envs\zhangjiaying\lib\site-packages\torch\utils\data\dataloader.py", line 1203, in _next_data return self._process_data(data) File "E:\anaconda3\envs\zhangjiaying\lib\site-packages\torch\utils\data\dataloader.py", line 1229, in _process_data data.reraise() File "E:\anaconda3\envs\zhangjiaying\lib\site-packages\torch_utils.py", line 438, in reraise raise exception ValueError: Caught ValueError in DataLoader worker process 0. Original Traceback (most recent call last): File "E:\anaconda3\envs\zhangjiaying\lib\site-packages\torch\utils\data_utils\worker.py", line 287, in _worker_loop data = fetcher.fetch(index) File "E:\anaconda3\envs\zhangjiaying\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "E:\anaconda3\envs\zhangjiaying\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "E:\zjy\hyperseg-main\hyperseg\datasets\Massachusetts.py", line 104, in getitem img, target = self.transforms(img, target) File "E:\zjy\hyperseg-main\hyperseg\datasets\seg_transforms.py", line 78, in call input = list(t(*input)) File "E:\zjy\hyperseg-main\hyperseg\datasets\seg_transforms.py", line 199, in call img = larger_edge_resize(img, self.size, self.interpolation) File "E:\zjy\hyperseg-main\hyperseg\datasets\seg_transforms.py", line 174, in larger_edge_resize return img.resize(size[::-1], interpolation) File "E:\anaconda3\envs\zhangjiaying\lib\site-packages\PIL\Image.py", line 1861, in resize raise ValueError( ValueError: Unknown resampling filter (InterpolationMode.BICUBIC). Use Image.NEAREST (0), Image.LANCZOS (1), Image.BILINEAR (2), Image.BICUBIC (3), Image.BOX (4) or Image.HAMMING (5)

JoyeeZhang commented 2 years ago

And I don't calculate the weights of classes because the data just has two classes, building and no_building. I want to know that if it is necessary to calculate the weights.

JoyeeZhang commented 2 years ago

I found the same problems also appear when I train the model on data CamVid.

jankin-wang commented 2 years ago

have you solved this problem? I met the same problem before the Original Traceback.

JoyeeZhang commented 2 years ago

I think maybe because of the version of your environment. I have solved this problem after I changed my environment.

jankin-wang commented 2 years ago

Thank you for your answer, but my code can run on another dataset. So I checked the current data set. Unfortunately, no problems were found. It is strange that my original trace gave me the wrong code that had been run before and had no problems.Do you know why?

JoyeeZhang commented 2 years ago

Is the dataset you tried successfully given by the author? Or your own? And what about the dataset you cannot run?

jankin-wang commented 2 years ago

Thank you for your advice.It is truly the problem of my data set.I download my data set on GitHub and find that it is different from the official data set

870572761 commented 2 years ago

I use the dataset given by author. But the bug still occurs. I don't understand change what version of environment. Could you tell me more detail of your solution?

YuvalNirkin commented 2 years ago

I fixed this issue and added an exact environment installation yml.

ZK1924 commented 1 year ago

hello, can you tell me you change which version of environment