salaniz / pycocoevalcap

Python 3 support for the MS COCO caption evaluation tools
Other
293 stars 82 forks source link

bleu error #1

Closed b10112157 closed 6 years ago

b10112157 commented 6 years ago

i use captions_val2014.json,but bleu value wrong . how to solve it.?

gts = tokenizer.tokenize(gts) i try "print (gts) in eval.py",but show the {458755: ['']} my equip is py 3.5.4,and tf 1.4.0 image

salaniz commented 6 years ago

Can you please try to run the example from the original repository https://github.com/tylin/coco-caption, namely by getting:

and then running the provided notebook: cocoEvalCapDemo.ipynb

Does the code work then? Maybe your results.json is not in the correct format?

b10112157 commented 6 years ago

ok ,i can try it . my python is py3.5. the project can run the py35?

b10112157 commented 6 years ago

sorry i run this project . but get some error. how to solve it the problem? image

salaniz commented 6 years ago

You have to use the current project for Python 3 support not the original one.

So you have to do the following on a clean directory:

from pycocotools.coco import COCO
from pycocoevalcap.eval import COCOEvalCap

dataDir = '.'
dataType = 'val2014'
algName = 'fakecap'
annFile = '%s/annotations/captions_%s.json'%(dataDir,dataType)
resFile = '%s/results/captions_%s_%s_results.json'%(dataDir,dataType,algName)

coco = COCO(annFile)
cocoRes = coco.loadRes(resFile)

cocoEval = COCOEvalCap(coco, cocoRes)
cocoEval.params['image_id'] = cocoRes.getImgIds()

cocoEval.evaluate()
b10112157 commented 6 years ago

in the step 1: command line in cocoapi/pythonAPI "python setup.py build_ext --inplace" and "python setup.py build_ext install" Is it the correct procedure? but show output that image

salaniz commented 6 years ago

I seems like you don’t have a C++ compiler installed or it's not in your PATH environment variable because the error comes from not finding cl.exe.

b10112157 commented 6 years ago

i command python setup.py install now it can "import pycocotools " in the step 2, i put the bleu、cider 、metor 、rough、tokenizer 、eval.py .in the folder pycocoevalcap. and clone "\annotations\captions_val2014.json" and "\results\captions_val2014_fakecap_results.json"

and run this code but show that . image

b10112157 commented 6 years ago

thanks i already use it , i forget install java

salaniz commented 6 years ago

Then I assume the issue is resolved.