Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in calculating SPICE score #25

Open
Rasesh2005 opened this issue Jul 22, 2024 · 1 comment
Open

Error in calculating SPICE score #25

Rasesh2005 opened this issue Jul 22, 2024 · 1 comment

Comments

@Rasesh2005
Copy link

On Running the example given in the code, I am receiving the following error:
Seems some issue with not able to find a java library:

Reasons: [no lmdbjni64-0.4.6 in java.library.path, no lmdbjni-0.4.6 in java.library.path, no lmdbjni in java.library.path, Can't load library: /var/folders/vn/7_bb_kks6rbd2__4b3l7_1540000gn/T/liblmdbjni-64-0-6369492975798876796.4]

Complete error in terminal on running example python file

loading annotations into memory...
Done (t=0.13s)
creating index...
index created!
Loading and preparing results...
DONE (t=0.01s)
creating index...
index created!
tokenization...
PTBTokenizer tokenized 61268 tokens at 696391.15 tokens per second.
PTBTokenizer tokenized 10892 tokens at 189492.14 tokens per second.
setting up scorers...
computing Bleu score...
{'testlen': 9893, 'reflen': 9855, 'guess': [9893, 8893, 7893, 6893], 'correct': [5732, 2510, 1043, 423]}
ratio: 1.003855910705124
Bleu_1: 0.579
Bleu_2: 0.404
Bleu_3: 0.279
Bleu_4: 0.191
computing METEOR score...
METEOR: 0.195
computing Rouge score...
ROUGE_L: 0.396
computing CIDEr score...
CIDEr: 0.600
computing SPICE score...
Parsing reference captions
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no lmdbjni64-0.4.6 in java.library.path, no lmdbjni-0.4.6 in java.library.path, no lmdbjni in java.library.path, Can't load library: /var/folders/vn/7_bb_kks6rbd2__4b3l7_1540000gn/T/liblmdbjni-64-0-6369492975798876796.4]
        at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:187)
        at org.fusesource.hawtjni.runtime.Library.load(Library.java:143)
        at org.fusesource.lmdbjni.JNI.<clinit>(JNI.java:41)
        at org.fusesource.lmdbjni.Env.create(Env.java:57)
        at org.fusesource.lmdbjni.Env.<init>(Env.java:51)
        at edu.anu.spice.LmdbTupleDB.getTransaction(LmdbTupleDB.java:92)
        at edu.anu.spice.SpiceParser.loadTuplesFromDB(SpiceParser.java:195)
        at edu.anu.spice.SpiceParser.loadTuples(SpiceParser.java:245)
        at edu.anu.spice.SpiceParser.parseCaptions(SpiceParser.java:251)
        at edu.anu.spice.SpiceScorer.scoreBatch(SpiceScorer.java:109)
        at edu.anu.spice.SpiceScorer.main(SpiceScorer.java:60)
Traceback (most recent call last):
  File "/Users/rasesh/Downloads/pycocoevalcap-master/example/coco_eval_example.py", line 21, in <module>
    coco_eval.evaluate()
  File "/opt/anaconda3/envs/MLTesting/lib/python3.11/site-packages/pycocoevalcap/eval.py", line 53, in evaluate
    score, scores = scorer.compute_score(gts, res)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/MLTesting/lib/python3.11/site-packages/pycocoevalcap/spice/spice.py", line 75, in compute_score
    subprocess.check_call(spice_cmd, 
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/MLTesting/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['java', '-jar', '-Xmx8G', 'spice-1.0.jar', '/opt/anaconda3/envs/MLTesting/lib/python3.11/site-packages/pycocoevalcap/spice/tmp/tmpd6rfgrz_', '-cache', '/opt/anaconda3/envs/MLTesting/lib/python3.11/site-packages/pycocoevalcap/spice/cache', '-out', '/opt/anaconda3/envs/MLTesting/lib/python3.11/site-packages/pycocoevalcap/spice/tmp/tmptjzkdzpq', '-subset', '-silent']' returned non-zero exit status 1.
@morninghut
Copy link

I just solved the same problem.
You can check here: tylin#42
And consider to comment -cache, cache_dir in spice.py if you still get error output

If you try them and still get xxx not found, consider to install JDK8/9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants