sparse_caption.scst.cider.pyciderevalcap.cider package

Submodules

sparse_caption.scst.cider.pyciderevalcap.cider.cider module

class sparse_caption.scst.cider.pyciderevalcap.cider.cider.Cider(n=4, df='corpus')

Bases: object

Main Class to compute the CIDEr metric

compute_score(gts, res)

Main function to compute CIDEr score : param gts (dict) : {image:tokenized reference sentence} : param res (dict) : {image:tokenized candidate sentence} : return: cider (float) : computed CIDEr score for the corpus

method()

sparse_caption.scst.cider.pyciderevalcap.cider.cider_scorer module

class sparse_caption.scst.cider.pyciderevalcap.cider.cider_scorer.CiderScorer(df_mode='corpus', test=None, refs=None, n=4, sigma=6.0)

Bases: object

CIDEr scorer.

clear()
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.scst.cider.pyciderevalcap.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.scst.cider.pyciderevalcap.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.scst.cider.pyciderevalcap.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