kdexd / virtex

[CVPR 2021] VirTex: Learning Visual Representations from Textual Annotations
http://kdexd.xyz/virtex
MIT License
556 stars 61 forks source link

error in evaluating image caption, not find or load main class edu.stanford.nlp.process.PTBTokenizer #17

Closed BaohaoLiao closed 3 years ago

BaohaoLiao commented 3 years ago

Hi, this is really a great job and clear codebase.

However, I face a problem when I want to evaluate the Image Captioning on COCO Captions val2017. It said "Error: Could not find or load main class edu.stanford.nlp.process.PTBTokenizer".

I have downloaded CoreNLP and Spice with your config 'download_spice.sh'. Besides, I also set the path in my bashrc file that is: export CLASSPATH="$CLASSPATH:/path/to/virtex/virtex/utils/assets/SPICE-1.0/lib/stanford-corenlp-3.6.0.jar:/path/to/virtex/virtex/utils/assets/SPICE-1.0/lib/stanford-corenlp-3.6.0-models.jar for file in 'find /path/to/virtex/virtex/utils/assets/SPICE-1.0/lib -name "*.jar"'; do export CLASSPATH="$CLASSPATH:'realpath $file'"; done

I could run java -mx3g edu.stanford.nlp.pipeline.StanfordCoreNLP -outputFormat json -file input.txt successfully with sentences in input.txt.

In addition, If I don't calculate metrics, i.e. without --calc-metrics, it works fine.

Do you have any idea about this problem?

BaohaoLiao commented 3 years ago

Hi, this is really a great job and clear codebase.

However, I face a problem when I want to evaluate the Image Captioning on COCO Captions val2017. It said "Error: Could not find or load main class edu.stanford.nlp.process.PTBTokenizer".

I have downloaded CoreNLP and Spice with your config 'download_spice.sh'. Besides, I also set the path in my bashrc file that is: export CLASSPATH="$CLASSPATH:/path/to/virtex/virtex/utils/assets/SPICE-1.0/lib/stanford-corenlp-3.6.0.jar:/path/to/virtex/virtex/utils/assets/SPICE-1.0/lib/stanford-corenlp-3.6.0-models.jar for file in 'find /path/to/virtex/virtex/utils/assets/SPICE-1.0/lib -name "*.jar"'; do export CLASSPATH="$CLASSPATH:'realpath $file'"; done

I could run java -mx3g edu.stanford.nlp.pipeline.StanfordCoreNLP -outputFormat json -file input.txt successfully with sentences in input.txt.

In addition, If I don't calculate metrics, i.e. without --calc-metrics, it works fine.

Do you have any idea about this problem?

I found what caused this. There is a small mistake in 'download_spice.sh'. We need to unzip stanford-corenlp-full-2014-08-27.zip also. By the way, it seems we do not need to set the path in bashrc file.