当前位置: 首页>>代码示例>>Python>>正文


Python ciderD.CiderD方法代码示例

本文整理汇总了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) 
开发者ID:eric-xw,项目名称:AREL,代码行数:26,代码来源:criterion.py

示例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) 
开发者ID:ltguo19,项目名称:VSUA-Captioning,代码行数:7,代码来源:rewards_graph.py

示例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) 
开发者ID:ruotianluo,项目名称:self-critical.pytorch,代码行数:9,代码来源:rewards.py

示例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) 
开发者ID:jiasenlu,项目名称:NeuralBabyTalk,代码行数:9,代码来源:rewards.py

示例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) 
开发者ID:Sundrops,项目名称:video-caption.pytorch,代码行数:5,代码来源:rewards.py


注:本文中的pyciderevalcap.ciderD.ciderD.CiderD方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。