jhgan00 / java-ort-example-yolov5

Onnxruntime Java Example: yolov5
34 stars 8 forks source link

failed:Load model /java/java-ort-example-yolov5/target/classes/yolov5s.onnx failed #1

Closed VYRION-Ai closed 1 year ago

VYRION-Ai commented 1 year ago
ai.onnxruntime.OrtException: Error code - ORT_INVALID_ARGUMENT - message: Load model from /I:/python/java/java-ort-example-yolov5/target/classes/yolov5s.onnx failed:Load model /I:/python/java/java-ort-example-yolov5/target/classes/yolov5s.onnx failed
    at ai.onnxruntime.OrtSession.createSession(Native Method)
    at ai.onnxruntime.OrtSession.<init>(OrtSession.java:73)
    at ai.onnxruntime.OrtEnvironment.createSession(OrtEnvironment.java:222)
    at ai.onnxruntime.OrtEnvironment.createSession(OrtEnvironment.java:208)
    at com.example.yolov5.YoloV5.<init>(YoloV5.java:40)
    at com.example.app.SwingApp.<init>(SwingApp.java:36)
    at com.example.app.SwingApp.main(SwingApp.java:62)
VYRION-Ai commented 1 year ago

File file = ResourceUtils.getFile("classpath:best.onnx"); String modelPath = String.valueOf((file)); File file2 = ResourceUtils.getFile("classpath:coco.names"); String labelPath = String.valueOf((file2));