當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。