Closed OBVIOUSDAWN closed 2 years ago
It seems that sim_index is not a 1-dimensional array. can your print the sim_index before the line 51 in get_sim_index?
It seems that sim_index is not a 1-dimensional array. can your print the sim_index before the line 51 in get_sim_index?
Thank you for your reply. I tried to print out sim_index before line51, but I found the following error and could not print the sim_index:
def get_sim_index(sample_num, nohoi_index, sim_index):
for i in range(len(nohoi_index)):
if nohoi_index[i] in sim_index:
sim_index.remove(nohoi_index[i])
print("+++++++++++++++++++++++++++++++")
print("sim_index")
print("+++++++++++++++++++++++++++++++")
random_index = np.random.choice(sim_index, sample_num, replace=True)
return list(random_index)
The same error has been encountered with this notation and cannot display the sim_index content
def get_sim_index(sample_num, nohoi_index, sim_index):
print("+++++++++++++++++++++++++++++++")
print("sim_index")
print("+++++++++++++++++++++++++++++++")
for i in range(len(nohoi_index)):
if nohoi_index[i] in sim_index:
sim_index.remove(nohoi_index[i])
random_index = np.random.choice(sim_index, sample_num, replace=True)
return list(random_index)
This way the program will get stuck and cannot display the sim_index content.
I infer from the paper that the code in this part may be related to the stitching way in the process of data enhancement, I don't know whether it is correct.I m looking forward to your reply. Thank you again for your help.
print(sim_index) instead of print("sim_index"), make sure your load the correct pickle file. if the sim_index is not a 1-dimensional array , your can check the self.sim_index have load pickle file in vcoco.py
print(sim_index) instead of print("sim_index"), make sure your load the correct pickle file. if the sim_index is not a 1-dimensional array , your can check the self.sim_index have load pickle file in vcoco.py
Thank you for your reply.The above error was caused when I typed the issue, the actual code has no corresponding error, and the result is the same as described. In addition, we tried to print it in vcoco. py, modified as follows
def get_sim_index(self):
self.sim_index = pickle.load(open('data/v-coco/annotations/sim_index_vcoco.pickle', 'rb'))
print("==========================================")
print(self.sim_index)
print("==========================================")
and the result shows
{'index': [4203, 4578, 2105, 4532, 3951, 3016, 5194, 4662, 1703, 2220, 1092, 990, 596, 3723, 515, 4658], 'cos': array([1. , 0.8254187 , 0.80570924, 0.80315 , 0.79597265,
0.7808205 , 0.7796549 , 0.7756003 , 0.773574 , 0.7721612 ,
0.7712145 , 0.7696761 , 0.769509 , 0.76844037, 0.76691663,
0.765468 ], dtype=float32)}, {'index': [4204, 1333, 1340, 3350, 1458, 4480, 2461, 798, 3214, 2198, 3712, 764, 3487, 3894, 860, 981], 'cos': array([1. , 0.8411544 , 0.84098417, 0.83964956, 0.83717054,
0.8365972 , 0.83565295, 0.8346963 , 0.82870823, 0.8275825 ,
0.8273761 , 0.8264537 , 0.82584995, 0.8244393 , 0.8241825 ,
0.8235995 ], dtype=float32)},
Sorry, it is a bug casued by incorrect file "sim_index_vcoco.pickle" and it actually only include 'index'(this is why report TypeError: 'dict' object cannot be interpreted as an integer and ValueError: a must be 1-dimensional or an integer). The correct file will be uploaded soon. Thank you for finding this bug!
Sorry, we found that we provided the wrong file, the file link will update soon!
the correct file is uploaded https://drive.google.com/file/d/1ePBUMU_gtbND4iSHYTIkBtUdb4Yr_zNK/view?usp=sharing
Sorry, it is a bug casued by incorrect file "sim_index_vcoco.pickle" and it actually only include 'index'(this is why report TypeError: 'dict' object cannot be interpreted as an integer and ValueError: a must be 1-dimensional or an integer). The correct file will be uploaded soon. Thank you for finding this bug!
Thank you for your reply. Everything is fine after replacing the new one sim_index_vcoco.pickle
Sorry, we found that we provided the wrong file, the file link will update soon!
Thank you for your reply. Everything is fine after replacing the new one sim_index_vcoco.pickle。 In addition, I would like to know what the parameters in sim_index_vcoco.pickle represent, and would appreciate for some explanation. We have seen a similar prior.pickle in qpic and still don't know its meaning after printing. Thank you again for your help. And I look forward to your reply!
I tried to reproduce the code for training on vcoco dataset, but there was a problem, and the error message was as follows: `Traceback (most recent call last): File "main.py", line 322, in
main(args)
File "main.py", line 269, in main
args.clip_max_norm, args.model_name)
File "/media/wit-2080/72e8833a-507d-4969-9f18-1fd1ff669f74/WTL/DOQ-main/engine.py", line 43, in train_one_epoch
for samples, targets in metric_logger.log_every(data_loader, print_freq, header):
File "/media/wit-2080/72e8833a-507d-4969-9f18-1fd1ff669f74/WTL/DOQ-main/util/misc.py", line 228, in log_every
for obj in iterable:
File "/home/wit-2080/anaconda3/envs/pytorch1.7.1/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 435, in next
data = self._next_data()
File "/home/wit-2080/anaconda3/envs/pytorch1.7.1/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1085, in _next_data
return self._process_data(data)
File "/home/wit-2080/anaconda3/envs/pytorch1.7.1/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1111, in _process_data
data.reraise()
File "/home/wit-2080/anaconda3/envs/pytorch1.7.1/lib/python3.7/site-packages/torch/_utils.py", line 428, in reraise
raise self.exc_type(msg)
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "mtrand.pyx", line 905, in numpy.random.mtrand.RandomState.choice
TypeError: 'dict' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/wit-2080/anaconda3/envs/pytorch1.7.1/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/home/wit-2080/anaconda3/envs/pytorch1.7.1/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/wit-2080/anaconda3/envs/pytorch1.7.1/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/media/wit-2080/72e8833a-507d-4969-9f18-1fd1ff669f74/WTL/DOQ-main/datasets/vcoco.py", line 50, in getitem
random_index = [idx] + get_sim_index(sim_im_num, self.nohoi_index, self.sim_index[idx])
File "/media/wit-2080/72e8833a-507d-4969-9f18-1fd1ff669f74/WTL/DOQ-main/datasets/stitch_images.py", line 51, in get_sim_index
random_index = np.random.choice(sim_index, sample_num, replace=True)
File "mtrand.pyx", line 907, in numpy.random.mtrand.RandomState.choice
ValueError: a must be 1-dimensional or an integer`
The experimental environment I adopted was Ubuntu16.04, Python3.7, Pytorch1.7.1, and the hardware device I used was 2080ti GPU*2, batchsize 2 per GPU. I tried training QPIC in the same environment and everything worked. I have tried to download annotations from Google Drive 3 times for training, so I can rule out the network problems caused by the tag file damaged during the download. According to the code, I inferred that there was a problem with pictures. I used complete COCO2014train /val in the data set and screened only pictures with vcoco tags. The same error occurred in the two types of data sets, which can run normally on QPIC. I want to know how to solve this problem. I m looking forward to your reply. Thank you again for your help.