Index error when I train superpoint
JuntingLee opened this issue · 5 comments
Hello, eric.
When I train superpoint for the third step
I get a error after 1188ite,
Traceback (most recent call last): File "train4.py", line 141, in <module> args.func(config, output_dir, args) File "train4.py", line 93, in train_joint train_agent.train() File "/home/lijt/PycharmProjects/pytorch-superpoint-master/Train_model_frontend.py", line 275, in train for i, sample_train in tqdm(enumerate(self.train_loader)): File "/home/lijt/anaconda3/envs/python36/lib/python3.6/site-packages/tqdm/std.py", line 1178, in __iter__ for obj in iterable: File "/home/lijt/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 517, in __next__ data = self._next_data() File "/home/lijt/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1179, in _next_data return self._process_data(data) File "/home/lijt/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data data.reraise() File "/home/lijt/anaconda3/envs/python36/lib/python3.6/site-packages/torch/_utils.py", line 429, in reraise raise self.exc_type(msg) IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/lijt/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop data = fetcher.fetch(index) File "/home/lijt/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/lijt/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/lijt/PycharmProjects/pytorch-superpoint-master/datasets/Coco.py", line 294, in __getitem__ labels = points_to_2D(pnts, H, W) File "/home/lijt/PycharmProjects/pytorch-superpoint-master/datasets/Coco.py", line 234, in points_to_2D labels[pnts[:, 1], pnts[:, 0]] = 1 IndexError: index -9223372036854775808 is out of bounds for axis 0 with size 240
I train many times from scratch and it happen again!
I don't know how to slove the problem.
hi, have you solve this problem? i meet the same problem
I have meet the same problem too…… and I found some some checks on whether a point is really in the image were ignored.
Hi @JuntingLee,
Thank you for your question.
I'm not sure why this happened.
Can you check if the points are loaded correctly?
pytorch-superpoint/datasets/Coco.py
Line 290 in 4ff74df
There may be some weird thing happening while converting the variable type (to Int).
@DreamWaterFound hi, have you solved this problem? same problem here.
@DreamWaterFound hi, have you solved this problem? same problem here.
@XinnWang Yes. Notice the function Coco.__getitem__.points_to_2D
in file datasets/Coco.py
(here), especially for COCO datasets with different image sizes, converted points has the possibility of falling outside the range of the image.
You can verify the corners' coordinates as following code:
def points_to_2D(pnts, H, W):
labels = np.zeros((H, W))
pnts = pnts.astype(int)
# HACK
mask = pnts[:,0] >= 0
pnts = pnts[mask, :]
mask = pnts[:,0] <= W
pnts = pnts[mask, :]
mask = pnts[:,1] >= 0
pnts = pnts[mask, :]
mask = pnts[:,0] <= H
pnts = pnts[mask, :]
# end hack
labels[pnts[:, 1], pnts[:, 0]] = 1
return labels
I am sorry for not indicating the location in the comments above.