The-Learning-And-Vision-Atelier-LAVA / SMSR

[CVPR 2021] Exploring Sparsity in Image Super-Resolution for Efficient Inference
237 stars 30 forks source link

IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed #18

Open afefbnsaid opened 2 years ago

afefbnsaid commented 2 years ago

hi, I tried to train the SMSR with my data but i got this error. IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed can you help me to solve it :)

LongguangWang commented 2 years ago

Hi @afefbnsaid, thanks for you interest in our work. Please provide more details about your training data and the error information (e.g., which line in which file) such that we can better help you.

afefbnsaid commented 2 years ago

My data were divided into two categories: super resolution (visible images) and low resolution (thermal images).

error details

700 /content/drive/MyDrive/database/benchmark/Set5/HR /content/drive/MyDrive/database/benchmark/Set5/LRbicubic 0 Making model... Preparing loss function: 1.000 * L1 [Epoch 1] Learning rate: 2.00e-4 Traceback (most recent call last): File "main.py", line 20, in t.train() File "/content/drive/My Drive/SMSR/trainer.py", line 43, in train for batch, (lr, hr, , idx_scale) in enumerate(self.loader_train): File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 582, in next return self._process_next_batch(batch) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch raise batch.exc_type(batch.exc_msg) IndexError: Traceback (most recent call last): File "/content/drive/My Drive/SMSR/dataloader.py", line 38, in _ms_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/content/drive/My Drive/SMSR/dataloader.py", line 38, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/content/drive/My Drive/SMSR/data/multiscalesrdata.py", line 144, in getitem lr, hr = self.get_patch(lr, hr) File "/content/drive/My Drive/SMSR/data/multiscalesrdata.py", line 195, in get_patch multi_scale=multi_scale File "/content/drive/My Drive/SMSR/data/common.py", line 35, in get_patch args[0][iy:iy + ip, ix:ix + ip, :],*[a[ty:ty + tp, tx:tx + tp, :] for a in args[1:]] IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed