Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
afefbnsaid opened this issue Jan 15, 2022 · 2 comments

Comments

@afefbnsaid
Copy link

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
Copy link
Member

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants