Open tonghaiping1996 opened 4 years ago
Did you use the submodules cider to compute cider?
thank you for your reply~ In the bash run_att_d.sh ,i set cider_optimization =1,then compute cider as follow and take the error: (what is the meaning of the submodules?) File "/mnt/code/dis_fpn+bot/models/JointModel.py", line 116, in forward reward, cider_greedy = rewards.get_self_critical_reward(data, gen_result, greedy_res) File "/mnt/code/dis_fpn+bot/misc/rewards.py", line 50, in get_self_critical_reward , cider_scores = CiderD_scorer.compute_score(gts, res)
I just redownloaded the submodule and still got this error...
File "/root/anaconda3/envs/PSENet1/lib/python2.7/site-packages/pyciderevalcap/ciderD/ciderD_scorer.py", line 133, in counts2vec df = np.log(max(1.0, self.document_frequency[ngram])) TypeError: 'float' object has no attribute 'getitem'
The path python2.7/site-packages/pyciderevalcap seems indicating that you can a pyciderevalcap installed in your enviroment. Can you verify if the path is different or the same?
I deleted the python2.7/site-packages/pyciderevalcap package,use the submodel under the DiscCaptioning-master,but still got the error...
File "train.py", line 242, in
Did you run python scripts/prepro_ngrams.py --input_json data/dataset_coco.json --dict_json data/cocotalk.json --output_pkl data/coco-train --split train
.
yes,the result files are there
I print the ngram of File "cider/pyciderevalcap/ciderD/ciderD_scorer.py", line 171, in counts2vec df = np.log(max(1.0, self.document_frequency[ngram])) the result :ngram>>>> <type 'tuple'> ('3', '1', '271', '17')
can you print self.document_frequency, this should be dictionary.
self.document_frequency: 0.0
can you print what's in coco-train-idx.p
Thank you very much. The problem really is in this document. Thank you again.
hello,when i run bash run_att_d.sh,it was wrong,can you help me ? thank you~: File "train.py", line 242, in
train(opt)
File "train.py", line 121, in train
loss = model(fc_feats, att_feats, att_masks, labels, masks, data)
File "/root/anaconda3/envs/PSENet1/lib/python2.7/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/mnt/code/dis_fpn+bot/models/JointModel.py", line 116, in forward
reward, cider_greedy = rewards.get_self_critical_reward(data, gen_result, greedy_res)
File "/mnt/code/dis_fpn+bot/misc/rewards.py", line 50, in get_self_criticalreward
, cider_scores = CiderD_scorer.computescore(gts, res)
File "/root/anaconda3/envs/PSENet1/lib/python2.7/site-packages/pyciderevalcap/ciderD/ciderD.py", line 49, in compute_score
(score, scores) = self.cider_scorer.compute_score()
File "/root/anaconda3/envs/PSENet1/lib/python2.7/site-packages/pyciderevalcap/ciderD/ciderD_scorer.py", line 209, in compute_score
score = self.compute_cider()
File "/root/anaconda3/envs/PSENet1/lib/python2.7/site-packages/pyciderevalcap/ciderD/ciderD_scorer.py", line 184, in compute_cider
vec, norm, length = counts2vec(test)
File "/root/anaconda3/envs/PSENet1/lib/python2.7/site-packages/pyciderevalcap/ciderD/ciderD_scorer.py", line 133, in counts2vec
df = np.log(max(1.0, self.document_frequency[ngram]))
TypeError: 'float' object has no attribute 'getitem'