sparse_caption.coco_caption package
Subpackages
- sparse_caption.coco_caption.pycocoevalcap package
- Subpackages
- sparse_caption.coco_caption.pycocoevalcap.bleu package
- sparse_caption.coco_caption.pycocoevalcap.cider package
- sparse_caption.coco_caption.pycocoevalcap.meteor package
- sparse_caption.coco_caption.pycocoevalcap.rouge package
- sparse_caption.coco_caption.pycocoevalcap.spice package
- sparse_caption.coco_caption.pycocoevalcap.tokenizer package
- Submodules
- sparse_caption.coco_caption.pycocoevalcap.eval module
- sparse_caption.coco_caption.pycocoevalcap.setup module
- Module contents
- Subpackages
Submodules
sparse_caption.coco_caption.eval module
Created on 31 Mar 2020 23:02:57
@author: jiahuei
- sparse_caption.coco_caption.eval.evaluate_caption_json(res_file, ann_file)
Given file paths to the caption prediction and annotation JSON files, will compute captioning metric scores as a dict.
The file paths can be absolute or relative. If relative, the files are assumed to be in coco_caption/results and coco_caption/annotations respectively.
- Parameters
res_file – File path to the caption prediction JSON file.
ann_file – File path to the caption annotation JSON file.
- Returns
- {
‘Bleu_1’: x.x, ‘Bleu_2’: x.x, ‘Bleu_3’: x.x, ‘Bleu_4’: x.x, ‘METEOR’: x.x, ‘ROUGE_L’: x.x, ‘CIDEr’: x.x, ‘SPICE’: x.x, }
- A list of scores for each image:
- [
{ ‘image_id’: 2090545563, ‘Bleu_1’: x.x, ‘Bleu_2’: x.x, ‘Bleu_3’: x.x, ‘Bleu_4’: x.x, ‘METEOR’: x.x, ‘ROUGE_L’: 0.0, ‘CIDEr’: 0.0, ‘SPICE’:
{ ‘All’: {‘pr’: 0.0, ‘re’: 0.0, ‘f’: 0.0, ‘fn’: 24.0, ‘numImages’: 1.0, ‘fp’: 7.0, ‘tp’: 0.0}, ‘Relation’: {‘pr’: 0.0, ‘re’: 0.0, ‘f’: 0.0, ‘fn’: 7.0, ‘numImages’: 1.0, ‘fp’: 0.0, ‘tp’: 0.0}, ‘Cardinality’: {‘pr’: 0.0, ‘re’: 0.0, ‘f’: 0.0, ‘fn’: 3.0, ‘numImages’: 1.0, ‘fp’: 0.0, ‘tp’: 0.0}, ‘Attribute’: {‘pr’: 0.0, ‘re’: 0.0, ‘f’: 0.0, ‘fn’: 7.0, ‘numImages’: 1.0, ‘fp’: 5.0, ‘tp’: 0.0}, ‘Size’: {‘pr’: 0.0, ‘re’: 0.0, ‘f’: 0.0, ‘fn’: 1.0, ‘numImages’: 1.0, ‘fp’: 0.0, ‘tp’: 0.0}, ‘Color’: {‘pr’: 0.0, ‘re’: 0.0, ‘f’: 0.0, ‘fn’: 1.0, ‘numImages’: 1.0, ‘fp’: 0.0, ‘tp’: 0.0}, ‘Object’: {‘pr’: 0.0, ‘re’: 0.0, ‘f’: 0.0, ‘fn’: 10.0, ‘numImages’: 1.0, ‘fp’: 2.0, ‘tp’: 0.0} }
]
COCO Eval object
- Return type
A dict with scores, with the following structure
Module contents
Created on 09 Jul 2020 23:36:50 @author: jiahuei