本文整理匯總了Python中pyciderevalcap.ciderD.ciderD.CiderD方法的典型用法代碼示例。如果您正苦於以下問題:Python ciderD.CiderD方法的具體用法?Python ciderD.CiderD怎麽用?Python ciderD.CiderD使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyciderevalcap.ciderD.ciderD
的用法示例。
在下文中一共展示了ciderD.CiderD方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from pyciderevalcap.ciderD import ciderD [as 別名]
# 或者: from pyciderevalcap.ciderD.ciderD import CiderD [as 別名]
def __init__(self, opt, dataset):
super(ReinforceCriterion, self).__init__()
self.dataset = dataset
self.reward_type = opt.reward_type
self.bleu = None
if self.reward_type == 'METEOR':
from vist_eval.meteor.meteor import Meteor
self.reward_scorer = Meteor()
elif self.reward_type == 'CIDEr':
sys.path.append("cider")
from pyciderevalcap.ciderD.ciderD import CiderD
self.reward_scorer = CiderD(df=opt.cached_tokens)
elif self.reward_type == 'Bleu_4' or self.reward_type == 'Bleu_3':
from vist_eval.bleu.bleu import Bleu
self.reward_scorer = Bleu(4)
self.bleu = int(self.reward_type[-1]) - 1
elif self.reward_type == 'ROUGE_L':
from vist_eval.rouge.rouge import Rouge
self.reward_scorer = Rouge()
else:
err_msg = "{} scorer hasn't been implemented".format(self.reward_type)
logging.error(err_msg)
raise Exception(err_msg)
示例2: init_scorer
# 需要導入模塊: from pyciderevalcap.ciderD import ciderD [as 別名]
# 或者: from pyciderevalcap.ciderD.ciderD import CiderD [as 別名]
def init_scorer(cached_tokens):
global CiderD_scorer
CiderD_scorer = CiderD_scorer or CiderD(df=cached_tokens)
global Bleu_scorer
Bleu_scorer = Bleu_scorer or Bleu(4)
示例3: init_scorer
# 需要導入模塊: from pyciderevalcap.ciderD import ciderD [as 別名]
# 或者: from pyciderevalcap.ciderD.ciderD import CiderD [as 別名]
def init_scorer(cached_tokens):
global CiderD_scorer
CiderD_scorer = CiderD_scorer or CiderD(df=cached_tokens)
global Cider_scorer
Cider_scorer = Cider_scorer or Cider(df=cached_tokens)
global Bleu_scorer
Bleu_scorer = Bleu_scorer or Bleu(4)
示例4: __init__
# 需要導入模塊: from pyciderevalcap.ciderD import ciderD [as 別名]
# 或者: from pyciderevalcap.ciderD.ciderD import CiderD [as 別名]
def __init__(self, opt):
super(get_self_critical_reward, self).__init__()
self.vocab_size = opt.vocab_size
self.st2towidx = opt.st2towidx
self.opt = opt
# self.st2towidx.requires_grad=False
self.CiderD_scorer = CiderD(df=opt.cached_tokens)
示例5: init_cider_scorer
# 需要導入模塊: from pyciderevalcap.ciderD import ciderD [as 別名]
# 或者: from pyciderevalcap.ciderD.ciderD import CiderD [as 別名]
def init_cider_scorer(cached_tokens):
global CiderD_scorer
CiderD_scorer = CiderD_scorer or CiderD(df=cached_tokens)