0

目前我收到以下错误:

Traceback (most recent call last):
  File "train.py", line 543, in <module>
    train(options)
  File "train.py", line 398, in train
    all_scores, combined_score = evaluation_metric_greedy(options, data_provision, sess, proposal_inputs, caption_inputs, proposal_outputs, caption_outputs)
  File "train.py", line 220, in evaluation_metric_greedy
    evaluator.evaluate()
  File "./densevid_eval-master/evaluator_old.py", line 111, in evaluate
    scores = self.evaluate_tiou(tiou)
  File "./densevid_eval-master/evaluator_old.py", line 269, in evaluate_tiou
    score, scores = scorer.compute_score(gts[vid_id], res[vid_id])
  File "./densevid_eval-master/coco-caption/pycocoevalcap/meteor/meteor.py", line 43, in compute_score
    self.meteor_p.stdin.write('{}\n'.format(eval_line).encode())
IOError: [Errno 32] Broken pipe

在这里,我也在编写发生错误的代码片段。

代码片段:

def _stat(self, hypothesis_str, reference_list):
        # SCORE ||| reference 1 words ||| reference n words ||| hypothesis words
        hypothesis_str = hypothesis_str.replace('|||','').replace('  ',' ')
        score_line = ' ||| '.join(('SCORE', ' ||| '.join(reference_list), hypothesis_str))
        str_mess = '{}\n'.format(score_line)
        self.meteor_p.stdin.write(str_mess.encode())
        re = self.meteor_p.stdout.readline().decode()
        return re.strip()

这里 self.meteor_p.stdin.write(str_mess.encode()) 产生错误。目前我正在尝试在 google colab 上运行此代码。

4

0 回答 0