Closed quangdaist01 closed 2 years ago
Hi,
This might be caused by python version mismatch. You can try to upgrade your python version >=3.7 and see if it solves your problem. Please also double check if the input <hparam>
file is correct.
In addition, I think you directly fed the model with the original COCO-Search18 gaze data which was collected on a 1680x1050 display. In the paper we rescaled the images to 512x320 as well as the fixation locations. So you need to rescale the fixation coordinates first. Please find the rescaled fixations here.
Thank you for your suggestions. The problem is solved by changing the num_worker from 16 to 0 (Maybe because I run on cpu instead of gpu?). The code continued to run and then stumbled on another error. Is this error related to the scaling problem?
cat_name: cup
img_name: 000000546494.jpg
Traceback (most recent call last):
File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\train.py", line 60, in <module>
trainer.train()
File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\trainer.py", line 89, in train
for i_batch, batch in enumerate(self.train_img_loader):
File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\dataloader.py", line 530, in __next__
data = self._next_data()
File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\dataloader.py", line 570, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\data.py", line 98, in __getitem__
coding = utils.multi_hot_coding(self.annos[imgId], self.pa.patch_size,
File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\utils.py", line 328, in multi_hot_coding
aoi_ratio = calc_overlap_ratio(bbox, patch_size, patch_num)
File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\utils.py", line 311, in calc_overlap_ratio
aoi_ratio[0, y, x] = max((aoi_brx - aoi_tlx), 0) * max((aoi_bry - aoi_tly), 0) / float(patch_area)
IndexError: index 20 is out of bounds for axis 1 with size 20
Here is a screenshort of what was actually running untill the error
The problem is solved by changing the num_worker from 16 to 0
Are you running it on docker?
Thank you for your suggestions. The problem is solved by changing the num_worker from 16 to 0 (Maybe because I run on cpu instead of gpu?). The code continued to run and then stumbled on another error. Is this error related to the scaling problem?
cat_name: cup img_name: 000000546494.jpg Traceback (most recent call last): File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\train.py", line 60, in <module> trainer.train() File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\trainer.py", line 89, in train for i_batch, batch in enumerate(self.train_img_loader): File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\dataloader.py", line 530, in __next__ data = self._next_data() File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\dataloader.py", line 570, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\data.py", line 98, in __getitem__ coding = utils.multi_hot_coding(self.annos[imgId], self.pa.patch_size, File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\utils.py", line 328, in multi_hot_coding aoi_ratio = calc_overlap_ratio(bbox, patch_size, patch_num) File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\utils.py", line 311, in calc_overlap_ratio aoi_ratio[0, y, x] = max((aoi_brx - aoi_tlx), 0) * max((aoi_bry - aoi_tly), 0) / float(patch_area) IndexError: index 20 is out of bounds for axis 1 with size 20
Very likely. I am not sure if you are running the code on other dataset. The code assumes the input image size is 320x512 and the action space is 20x32. Hence, you would need to rescale all coordinates including the fixations and bounding boxes to 320x512 otherwise it would probably incur the out of range error. If you are using the COCO-Seach18 dataset, you can simply download the rescaled json files via this link.
The problem is solved by changing the num_worker from 16 to 0
Are you running it on docker?
I am trying to train the model on my local computer (and I don't have CUDA set up yet)
Thank you for your suggestions. The problem is solved by changing the num_worker from 16 to 0 (Maybe because I run on cpu instead of gpu?). The code continued to run and then stumbled on another error. Is this error related to the scaling problem?
cat_name: cup img_name: 000000546494.jpg Traceback (most recent call last): File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\train.py", line 60, in <module> trainer.train() File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\trainer.py", line 89, in train for i_batch, batch in enumerate(self.train_img_loader): File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\dataloader.py", line 530, in __next__ data = self._next_data() File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\dataloader.py", line 570, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\MSI I5\PycharmProjects\Scanpath\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\data.py", line 98, in __getitem__ coding = utils.multi_hot_coding(self.annos[imgId], self.pa.patch_size, File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\utils.py", line 328, in multi_hot_coding aoi_ratio = calc_overlap_ratio(bbox, patch_size, patch_num) File "C:\Users\MSI I5\PycharmProjects\Scanpath_Prediction\irl_dcb\utils.py", line 311, in calc_overlap_ratio aoi_ratio[0, y, x] = max((aoi_brx - aoi_tlx), 0) * max((aoi_bry - aoi_tly), 0) / float(patch_area) IndexError: index 20 is out of bounds for axis 1 with size 20
Very likely. I am not sure if you are running the code on other dataset. The code assumes the input image size is 320x512 and the action space is 20x32. Hence, you would need to rescale all coordinates including the fixations and bounding boxes to 320x512 otherwise it would probably incur the out of range error. If you are using the COCO-Seach18 dataset, you can simply download the rescaled json files via this link.
I was running on that dataset and got the above error, which is strange :(.
Please double check if the coordinates of the input fixations and bounding boxes do not exceed 320x512. Note that the rescaled json files have different names from what is specified in train.py. After you've download the rescaled json files, you need to change the file names in the code
Thank you for you super-quick support. I'll update when the problem is fixed. Thank you! Good day and good lunch!! ^^
Hello, I have to scale the bbox coordinates in the calc_overlap_ratio() function in util.py. I am still not sure if it is correct but currently the bug has gone. I am closing the issue. Thank you very much! Have a good day!
Hello, I'm very interested in your work. However, when I try to run train.py, I got an error. I don't know why it happenned and how to fix it? Any suggestions? Thank you. Here is the full traceback: