SMSR icon indicating copy to clipboard operation
SMSR copied to clipboard

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

Open afefbnsaid opened this issue 3 years ago • 2 comments

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 :)

afefbnsaid avatar Jan 15 '22 21:01 afefbnsaid

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.

LongguangWang avatar Jan 16 '22 09:01 LongguangWang

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/LR_bicubic 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

afefbnsaid avatar Jan 18 '22 09:01 afefbnsaid