yxgeee / FD-GAN

[NeurIPS-2018] FD-GAN: Pose-guided Feature Distilling GAN for Robust Person Re-identification.
https://yxgeee.github.io/projects/fdgan.html
281 stars 80 forks source link

IndexError: index 180 is out of bounds for axis 1 with size 128 #35

Closed kayakaracakaya closed 5 years ago

kayakaracakaya commented 5 years ago

Firstly, thanks for the project.

I tried to run this project with my own dataset. I used dukemtmc dataset as template and i changed all files with my files. I generate pose text files for my dataset and replace all 0 to -1. But i get an IndexError.

File "train.py", line 119, in main() File "train.py", line 73, in main for i, data in enumerate(train_loader): File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 819, in next return self._process_data(data) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/usr/local/lib/python3.6/dist-packages/torch/_utils.py", line 385, in reraise raise self.exc_type(msg) IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/FD-GAN/reid/utils/data/preprocessor.py", line 48, in getitem return [self._get_single_item_with_pose(index) for index in indices] File "/content/FD-GAN/reid/utils/data/preprocessor.py", line 48, in return [self._get_single_item_with_pose(index) for index in indices] File "/content/FD-GAN/reid/utils/data/preprocessor.py", line 85, in _get_single_item_with_pose maps = self._generate_pose_map(landmark) File "/content/FD-GAN/reid/utils/data/preprocessor.py", line 127, in _generate_pose_map map[landmark[i,0],landmark[i,1]]=1 IndexError: index 180 is out of bounds for axis 1 with size 128

What can i do for this? Thanks.

yxgeee commented 5 years ago

Firstly, thanks for the project.

I tried to run this project with my own dataset. I used dukemtmc dataset as template and i changed all files with my files. I generate pose text files for my dataset and replace all 0 to -1. But i get an IndexError.

File "train.py", line 119, in main() File "train.py", line 73, in main for i, data in enumerate(train_loader): File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 819, in next return self._process_data(data) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/usr/local/lib/python3.6/dist-packages/torch/_utils.py", line 385, in reraise raise self.exc_type(msg) IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/FD-GAN/reid/utils/data/preprocessor.py", line 48, in getitem return [self._get_single_item_with_pose(index) for index in indices] File "/content/FD-GAN/reid/utils/data/preprocessor.py", line 48, in return [self._get_single_item_with_pose(index) for index in indices] File "/content/FD-GAN/reid/utils/data/preprocessor.py", line 85, in _get_single_item_with_pose maps = self._generate_pose_map(landmark) File "/content/FD-GAN/reid/utils/data/preprocessor.py", line 127, in _generate_pose_map map[landmark[i,0],landmark[i,1]]=1 IndexError: index 180 is out of bounds for axis 1 with size 128

What can i do for this? Thanks.

The images are resized to (256,128) as default settings. Your logs show that the landmark location is out of bounds, i.e. larger than the width of 128. Try to match the image size and your pose files.

kayakaracakaya commented 5 years ago

Thanks for quick reply.

I resized all my images to 64x128 manually.

This is one of my pose text files: 32 36 31 60 13 61 5 89 7 68 48 60 58 91 42 97 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 28 32 36 33 23 36 41 37

And this is one of the original pose text files: 36 22 54 31 54 15 79 6 99 0 53 48 77 60 102 60 103 27 141 37 178 50 102 44 140 32 187 23 32 20 33 27 35 17 33 38

There is no bound larger than 128. But i still get the error.

yxgeee commented 5 years ago

Thanks for quick reply.

I resized all my images to 64x128 manually.

This is one of my pose text files: 32 36 31 60 13 61 5 89 7 68 48 60 58 91 42 97 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 28 32 36 33 23 36 41 37

And this is one of the original pose text files: 36 22 54 31 54 15 79 6 99 0 53 48 77 60 102 60 103 27 141 37 178 50 102 44 140 32 187 23 32 20 33 27 35 17 33 38

There is no bound larger than 128. But i still get the error.

I seems that the columns of width and height are exchanged, please check. Maybe change the line in https://github.com/yxgeee/FD-GAN/blob/master/reid/utils/data/preprocessor.py#L126 to

map[landmark[i,1],landmark[i,0]]=1

would solve your problem.

kayakaracakaya commented 5 years ago

Yes, it solved my problem. Thank you very much.