Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Exception in thread "main" org.apache.mxnet.MXNetError--run java exmaple code error #18389

Open
dlearner2020 opened this issue May 22, 2020 · 0 comments
Labels

Comments

@dlearner2020
Copy link

Description

I want to inference a pic by java,so I've followed the official instructions (https://mxnet.apache.org/api/java.html) and configured a maven project.But when I tried to run the sample code(ObjectDetectionTutorial.java),I encountered 2 issues:
1.when I run
java -cp "target/javaMXNet-1.0-SNAPSHOT.jar:target/dependency/*" mxnet.ObjectDetectionTutorial
in terminal,it returns an error:
错误: 找不到或无法加载主类 mxnet.ObjectDetectionTutorial
(Error: Could not find or load main class)
2.When I run using the command shown below:
bash bin/run_od.sh
It will return another error:

oak@oaksheild:~/下载/java-demo$ bash bin/run_od.sh
modelPath: /home/oak/CODE/resnet50_ssd/resnet50_ssd_model
imagePath: /home/oak/CODE/resnet50_ssd/images/dog.jpg
[org.apache.mxnet.infer.MXNetThreadPoolHandler-0] INFO MXNetJVM - Try loading mxnet-scala from native path.
[org.apache.mxnet.infer.MXNetThreadPoolHandler-0] INFO MXNetJVM - Copying and loading native library from the jar archive
Exception in thread "main" org.apache.mxnet.MXNetError: MXNetError: Check failed: ch == '"' (-1 vs. ") : Error at Line 763, around ^``, Expect '"' but get 'ÿ'
Stack trace:
File "/work/mxnet/3rdparty/dmlc-core/include/dmlc/./json.h", line 677

at org.apache.mxnet.Base$.checkCall(Base.scala:110)
at org.apache.mxnet.Symbol$.load(Symbol.scala:1357)
at org.apache.mxnet.Model$.loadCheckpoint(Model.scala:70)
at org.apache.mxnet.module.Module$.loadCheckpoint(Module.scala:644)
at org.apache.mxnet.infer.Predictor$$anonfun$14.apply(Predictor.scala:256)
at org.apache.mxnet.infer.Predictor$$anonfun$14.apply(Predictor.scala:256)
at org.apache.mxnet.infer.MXNetThreadPoolHandler$$anon$4.call(MXNetHandler.scala:83)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

[Thread-1] INFO org.apache.mxnet.util.NativeLibraryLoader - Deleting /tmp/mxnet1689381890391321595/libquadmath.so.0
[Thread-1] INFO org.apache.mxnet.util.NativeLibraryLoader - Deleting /tmp/mxnet1689381890391321595/libgfortran.so.3
[Thread-1] INFO org.apache.mxnet.util.NativeLibraryLoader - Deleting /tmp/mxnet1689381890391321595/mxnet-scala
[Thread-1] INFO org.apache.mxnet.util.NativeLibraryLoader - Deleting /tmp/mxnet1689381890391321595/libmxnet.so
[Thread-1] INFO org.apache.mxnet.util.NativeLibraryLoader - Deleting /tmp/mxnet1689381890391321595

Environment

OS:
cat /proc/version
Linux version 5.4.0-21-generic (buildd@lcy01-amd64-006) (gcc version 9.3.0 (Ubuntu 9.3.0-8ubuntu1)) #25-Ubuntu SMP Sat Mar 28 13:10:28 UTC 2020

installed from ubuntukylin-20.04-beta-enhanced-amd64.iso
java version:

oak@oaksheild:/CODE/java-demo$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1
18.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

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

No branches or pull requests

1 participant