VSUA-Captioning
VSUA-Captioning copied to clipboard
您好,我在读取数据遇到了IndexError: too many indices for array的问题
Traceback (most recent call last):
File "train.py", line 155, in
您好,我也在使用semantic relationship时遇到了这个问题,请问解决了吗?
您好,我也在使用semantic relationship时遇到了这个问题,请问解决了吗?
if sg_use['rela_matrix'].shape[0] == 0:
sg_use['rela_matrix'] = np.array([[0, 0, self.sg_vocab['near']]], dtype=sg_use['rela_matrix'].dtype)
修改之后,没有报错了
修改后迭代几次,还是报错,您没发生这个问题吗?
KeyError: 'Traceback (most recent call last):\n File "/home/b604_1/anaconda2/envs/pyli2.7/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 57, in _worker_loop\n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/b604_1/aaa/VSUA-Captioning/dataloader.py", line 253, in getitem\n sg_data = self.get_graph_data(index)\n File "/home/b604_1/aaa/VSUA-Captioning/dataloader.py", line 270, in get_graph_data\n sg_use['rela_matrix'] = np.array([[0, 0, self.sg_vocab['near']]], dtype=sg_use['rela_matrix'].dtype)\nKeyError: 'near'\n'