JiahuiYu / wdsr_ntire2018

Code of our winning entry to NTIRE super-resolution challenge, CVPR 2018
http://www.vision.ee.ethz.ch/ntire18/
598 stars 123 forks source link

An error when training with my own dataset with scale 3 or 4 #32

Closed zhangclaire closed 5 years ago

zhangclaire commented 5 years ago

Dear author: When using my own image dataset (image size is 600 *600) to train WDSR with the command '--scale 3 --patch size 144 or -- scale 4 --patch size 192', there exited an error:

Traceback (most recent call last): File "main.py", line 25, in t.train() File "/home/zhangshu/WDSR/src/trainer.py", line 41, in train for batch, (lr, hr, _, idx_scale) in enumerate(self.loader_train): File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 286, in next return self._process_next_batch(batch) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 307, in _process_next_batch raise batch.exc_type(batch.exc_msg) RuntimeError: Traceback (most recent call last): File "/home/zhangshu/WDSR/src/dataloader.py", line 47, in _ms_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/zhangshu/WDSR/src/dataloader.py", line 47, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataset.py", line 81, in getitem return self.datasets[dataset_idx][sample_idx] File "/home/zhangshu/WDSR/src/data/srdata.py", line 149, in getitem pair_t = common.np2Tensor(*pair, rgb_range=self.args.rgb_range) File "/home/zhangshu/WDSR/src/data/common.py", line 57, in np2Tensor return [_np2Tensor(a) for a in args] File "/home/zhangshu/WDSR/src/data/common.py", line 57, in return [_np2Tensor(a) for a in args] File "/home/zhangshu/WDSR/src/data/common.py", line 52, in _np2Tensor tensor = torch.from_numpy(np_transpose).float() RuntimeError: Trying to resize storage that is not resizable at /pytorch/aten/src/TH/generic/THStorage.c:183

When I train the model with DIV2K dataset ,everything is ok .However, when transferring to my own dataset ,the error above exited with scale 3 or 4. I don't know that whether my images are too small (600 *600) compared with DIV2K dataset? Hoping for your reply! Thank you very much!

JiahuiYu commented 5 years ago

tensor = torch.from_numpy(np_transpose).float() RuntimeError: Trying to resize storage that is not resizable at

You can debug into this line and see what’s going on.