我目前有 2 个文件,reference.txt 和 model.txt。这两个文本文件包含原始字幕和训练后生成的字幕。
我可以简单地执行以下操作来获取流星分数:
score = nltk.translate.meteor_score.meteor_score(reference, model)
print(np.mean(meteor_score))
我也看过https://github.com/tylin/coco-caption https://github.com/tylin/coco-caption但我不知道如何实现这一点。
让我们从定义术语开始
参考:实际文本/基本事实。如果有多个人为同一数据点生成基本事实,您将有多个参考,并且所有参考都被认为是正确的
假设:候选/预测。
假设两个人看一张图片并添加标题
现在你的模型查看图像并预测
您可以使用meteor_score来计算预测的好坏
print (nltk.translate.meteor_score.meteor_score(
["this is an apple", "that is an apple"], "an apple on this tree"))
print (nltk.translate.meteor_score.meteor_score(
["this is an apple", "that is an apple"], "a red color fruit"))
Output:
0.6233062330623306
0.0
在你的情况下,你必须阅读reference.txt
到一个列表中,相似性模型预测到另一个列表中。现在你必须得到meteor_score
对于第一个列表中的每一行和第二个列表中的每一行,最后取平均值。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)