You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No, this is not an issue. It's an example for whoever trying to use this package with their own data.
frompycocoevalcap.tokenizer.ptbtokenizerimportPTBTokenizerfrompycocoevalcap.bleu.bleuimportBleufrompycocoevalcap.meteor.meteorimportMeteorfrompycocoevalcap.rouge.rougeimportRougefrompycocoevalcap.cider.ciderimportCiderfrompycocoevalcap.spice.spiceimportSpiceclassEvaluator:
def__init__(self) ->None:
self.tokenizer=PTBTokenizer()
self.scorer_list= [
(Bleu(4), ["Bleu_1", "Bleu_2", "Bleu_3", "Bleu_4"]),
(Meteor(), "METEOR"),
(Rouge(), "ROUGE_L"),
(Cider(), "CIDEr"),
(Spice(), "SPICE"),
]
self.evaluation_report= {}
defdo_the_thing(self, golden_reference, candidate_reference):
golden_reference=self.tokenizer.tokenize(golden_reference)
candidate_reference=self.tokenizer.tokenize(candidate_reference)
# From this point, some variables are named as in the original code# I have no idea why they name like these# The original code: https://github.com/salaniz/pycocoevalcap/blob/a24f74c408c918f1f4ec34e9514bc8a76ce41ffd/eval.py#L51-L63forscorer, methodinself.scorer_list:
score, scores=scorer.compute_score(golden_reference, candidate_reference)
ifisinstance(method, list):
forsc, scs, minzip(score, scores, method):
self.evaluation_report[m] =scelse:
self.evaluation_report[method] =scoregolden_reference= [
"The quick brown fox jumps over the lazy dog.",
"The brown fox quickly jumps over the lazy dog.",
"A sly brown fox jumps over the lethargic dog.",
"The speedy brown fox leaps over the sleepy hound.",
"A fast, brown fox jumps over the lazy dog.",
]
golden_reference= {k: [{'caption': v}] fork, vinenumerate(golden_reference)}
candidate_reference= [
"A fast brown fox leaps above the tired dog.",
"A quick brown fox jumps over the sleepy dog.",
"The fast brown fox jumps over the lazy dog.",
"The brown fox jumps swiftly over the lazy dog.",
"A speedy brown fox leaps over the drowsy dog.",
]
candidate_reference= {k: [{'caption': v}] fork, vinenumerate(candidate_reference)}
evaluator=Evaluator()
evaluator.do_the_thing(golden_reference, candidate_reference)
print(evaluator.evaluation_report)
The text was updated successfully, but these errors were encountered:
If this package is still actively being used by the community as opposed to newer alternatives, we could think about extending the original API to make integration easier for these use cases.
I suppose your suggestion would be the first step. I wonder if it would also make sense to update the metric evaluation libraries as they currently pinned to old releases.
@salaniz This package is still used widely. However, people just copy and modify (like I do) for their own needs.
There are indeed newer alternatives such as HuggingFace Evaluation lib or NLTK metrics.
Extending and refactoring API is possible. The tough task is to ship Java stuff. Not many people want to have Java installed in their system. For anyone want to work on this package, please just don't use Java.
No, this is not an issue. It's an example for whoever trying to use this package with their own data.
The text was updated successfully, but these errors were encountered: