jcjohnson / densecap

Dense image captioning in Torch
MIT License
1.58k stars 429 forks source link

IOError: [Errno 32] Broken pipe on File "eval/meteor_bridge.py #50

Closed SeekPoint closed 8 years ago

SeekPoint commented 8 years ago

th train.lua ..... Processed image 2395971.jpg (997 / 1000) of split 1, detected 100 regions
Processed image 2395960.jpg (998 / 1000) of split 1, detected 107 regions
Processed image 2395955.jpg (999 / 1000) of split 1, detected 93 regions
Processed image 2395949.jpg (1000 / 1000) of split 1, detected 109 regions
Loss stats: { mid_box_reg_loss : 0.0010088438019855 captioning_loss : 27.884303262711 end_box_reg_loss : 0.0020599792839494 end_objectness_loss : 0.042175837257504 total_loss : 28.011510998734 mid_objectness_loss : 0.081963075679541 } Average loss: 28.011510998734 Traceback (most recent call last): File "eval/meteor_bridge.py", line 69, in score = m._score(r['candidate'], r['references']) File "eval/meteor_bridge.py", line 39, in _score self.meteor_p.stdin.write(w) IOError: [Errno 32] Broken pipe /home/rzai/torch/install/bin/luajit: ./densecap/utils.lua:86: attempt to index local 'file' (a nil value) stack traceback: ./densecap/utils.lua:86: in function 'read_json' ./eval/eval_utils.lua:100: in function 'score_captions' ./eval/eval_utils.lua:231: in function 'evaluate' ./eval/eval_utils.lua:83: in function 'eval_split' train.lua:153: in main chunk [C]: in function 'dofile' ...rzai/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00406670 rzai@rzai00:~/prj/densecap$ rzai@rzai00:~/prj/densecap$ ll eval total 19088 drwxrwxr-x 2 rzai rzai 4096 10月 27 11:29 ./ drwxrwxr-x 14 rzai rzai 4096 10月 27 13:42 ../ -rw-rw-r-- 1 rzai rzai 10674 10月 24 17:18 eval_utils.lua -rw-rw-r-- 1 rzai rzai 38 10月 24 17:18 .gitignore -rw-rw-r-- 1 rzai rzai 13190274 10月 27 14:31 input.json -rw-r--r-- 1 rzai rzai 6318623 10月 27 03:09 meteor-1.5.jar -rw-rw-r-- 1 rzai rzai 2695 10月 24 17:18 meteor_bridge.py -rw-rw-r-- 1 rzai rzai 2851 10月 24 17:18 README.md rzai@rzai00:~/prj/densecap$

Dorniwang commented 8 years ago

I have also met this problem and it confuse me several days. Hope someone can give an awesome solution for this issue.

Dorniwang commented 8 years ago

i have solved this issue. i do not know whether the cause of my problem is same as your's, but i can tell you my solution as reference. When execute eval_utils.lua, it calls 'meteor_bridge.py', the function of this python file is just as the author announced. when new a subprocess.Popen object, it needs an 'arg' parameter, and "By default, the program to execute is the first item in args if args is a sequence". in this python file, this 'arg' parameter give the way the meteor-1.5.jar execute. I try to execute the java command in terminal, and i found it can not identify the "....../data/paraphrase-en.gz" path, because the path contains some characters the java program can not identify, so i change the directory to all english name, and it worked out!!!

SeekPoint commented 8 years ago

@Dorniwang I don't find the "....../data/paraphrase-en.gz" path

rzai@rzai00:/media/rzai/ai_data/prj/densecap$ find . -name "*en.gz" -print rzai@rzai00:/media/rzai/ai_data/prj/densecap$ find . -name "paraphrase" -print

rzai@rzai00:/media/rzai/ai_data/prj/densecap$ cd data/ rzai@rzai00:/media/rzai/ai_data/prj/densecap/data$ tree . ├── models │   ├── densecap │   │   └── densecap-pretrained-vgg16.t7 │   └── vgg-16 │   ├── VGG_ILSVRC_16_layers.caffemodel │   └── VGG_ILSVRC_16_layers_deploy.prototxt.lua ├── VG-regions-dicts.json └── VG-regions.h5

3 directories, 5 files rzai@rzai00:/media/rzai/ai_data/prj/densecap/data$

Dorniwang commented 8 years ago

you should notice what the author said:https://github.com/jcjohnson/densecap/blob/master/eval/README.md, it is mentioned in the Requirement that "you'll need to download the METEOR binary meteor-1.5.jar and place it in eval folder and also paraphrase-en.gz and place it it in eval/data folder."

SeekPoint commented 8 years ago

so, you got this error by non-english characters, and I missed the paraphrase-en.gz