本文整理汇总了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)