sparse_caption.coco_caption.pycocoevalcap.cider package
Submodules
sparse_caption.coco_caption.pycocoevalcap.cider.cider module
- class sparse_caption.coco_caption.pycocoevalcap.cider.cider.Cider(test=None, refs=None, n=4, sigma=6.0)
Bases:
objectMain Class to compute the CIDEr metric
- compute_score(gts, res)
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
- method()
sparse_caption.coco_caption.pycocoevalcap.cider.cider_scorer module
- class sparse_caption.coco_caption.pycocoevalcap.cider.cider_scorer.CiderScorer(test=None, refs=None, n=4, sigma=6.0)
Bases:
objectCIDEr scorer.
- compute_cider()
- compute_doc_freq()
Compute term frequency for reference data. This will be used to compute idf (inverse document frequency later) The term frequency is stored in the object :return: None
- compute_score(option=None, verbose=0)
- cook_append(test, refs)
called by constructor and __iadd__ to avoid creating new instances.
- copy()
copy the refs.
- size()
- sparse_caption.coco_caption.pycocoevalcap.cider.cider_scorer.cook_refs(refs, n=4)
Takes a list of reference sentences for a single segment and returns an object that encapsulates everything that BLEU needs to know about them. :param refs: list of string : reference sentences for some image :param n: int : number of ngrams for which (ngram) representation is calculated :return: result (list of dict)
- sparse_caption.coco_caption.pycocoevalcap.cider.cider_scorer.cook_test(test, n=4)
Takes a test sentence and returns an object that encapsulates everything that BLEU needs to know about it. :param test: list of string : hypothesis sentence for some image :param n: int : number of ngrams for which (ngram) representation is calculated :return: result (dict)
- sparse_caption.coco_caption.pycocoevalcap.cider.cider_scorer.precook(s, n=4, out=False)
Takes a string as input and returns an object that can be given to either cook_refs or cook_test. This is optional: cook_refs and cook_test can take string arguments as well. :param s: string : sentence to be converted into ngrams :param n: int : number of ngrams for which representation is calculated :return: term frequency vector for occuring ngrams
Module contents
Created on 09 Jul 2020 23:36:50 @author: jiahuei