代码调试
Closed this issue · 2 comments
Now Using swin
Epoch 1/50: 0%| | 0/999 [00:00<?, ?it/s<class 'dict'>]
Traceback (most recent call last):
File "/Home/atr2/shr/sky-challenge/U-Transformer-master/train.py", line 171, in
loss = fit_one_epoch(net, epoch, epoch_size, epoch_size_val, gen, gen_val, Total_Epoch, Cuda)
File "/Home/atr2/shr/sky-challenge/U-Transformer-master/train.py", line 37, in fit_one_epoch
for iteration, batch in enumerate(gen):
File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 628, in next
data = self._next_data()
File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1333, in _next_data
return self._process_data(data)
File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1359, in _process_data
data.reraise()
File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/_utils.py", line 543, in reraise
raise exception
IndexError: Caught IndexError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
data = fetcher.fetch(index)
File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 58, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/Home/atr2/shr/sky-challenge/U-Transformer-master/utils/dataloader.py", line 120, in getitem
img, y = self.get_random_data(lines[index], [self.input_size[0], self.input_size[1]], random=False)
File "/Home/atr2/shr/sky-challenge/U-Transformer-master/utils/dataloader.py", line 54, in get_random_data
box[:, [1]] = box[:, [1]] * nh / ih + dy
IndexError: index 1 is out of bounds for axis 1 with size 1
Now Using swin Epoch 1/50: 0%| | 0/999 [00:00<?, ?it/s<class 'dict'>] Traceback (most recent call last): File "/Home/atr2/shr/sky-challenge/U-Transformer-master/train.py", line 171, in loss = fit_one_epoch(net, epoch, epoch_size, epoch_size_val, gen, gen_val, Total_Epoch, Cuda) File "/Home/atr2/shr/sky-challenge/U-Transformer-master/train.py", line 37, in fit_one_epoch for iteration, batch in enumerate(gen): File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 628, in next data = self._next_data() File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1333, in _next_data return self._process_data(data) File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1359, in _process_data data.reraise() File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/_utils.py", line 543, in reraise raise exception IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/Home/atr2/miniconda3/envs/mojj/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 58, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/Home/atr2/shr/sky-challenge/U-Transformer-master/utils/dataloader.py", line 120, in getitem img, y = self.get_random_data(lines[index], [self.input_size[0], self.input_size[1]], random=False) File "/Home/atr2/shr/sky-challenge/U-Transformer-master/utils/dataloader.py", line 54, in get_random_data box[:, [1]] = box[:, [1]] * nh / ih + dy IndexError: index 1 is out of bounds for axis 1 with size 1
已解决!