xmodaler.scorer

xmodaler.scorer.build_scorer(cfg)[source]
class xmodaler.scorer.BaseScorer(*, types, scorers, weights, gt_path, eos_id)[source]

Bases: object

__init__(*, types, scorers, weights, gt_path, eos_id)[source]
classmethod from_config(cfg)[source]
get_sents(sent)[source]
class xmodaler.scorer.Cider(*, n: int, sigma: float, cider_cached: str)[source]

Bases: object

Main Class to compute the CIDEr metric

__init__(*, n: int, sigma: float, cider_cached: str)[source]
compute_score(gts, res)[source]

Main function to compute CIDEr score :param hypo_for_image (dict) : dictionary with key <image> and value <tokenized hypothesis / candidate sentence>

ref_for_image (dict) : dictionary with key <image> and value <tokenized reference sentence>

Returns:

cider (float) : computed CIDEr score for the corpus

classmethod from_config(cfg)[source]
method()[source]
class xmodaler.scorer.BertTokenizedScorer(*, types, scorers, weights, gt_path, bert_tokenizer)[source]

Bases: object

__init__(*, types, scorers, weights, gt_path, bert_tokenizer)[source]
classmethod from_config(cfg)[source]
get_sents(sent)[source]