microsoft / onnxruntime-nextjs-template

MIT License
96 stars 22 forks source link

Yolov5 converted model throws error during detection #2

Open lizozom opened 2 years ago

lizozom commented 2 years ago

I have followed the YOLOv5-Custom-Training tutorial and trained a model to detect some custom objects. The object works properly detecting objects.

I then exported the model to onnx using the following command: python export.py --include onnx --weight ./runs/train/exp/weights/best.pt --data {dataset.location}/data.yaml --img 640

The exported onnx model also properly detects objects.

I then took the onnxruntime-nextjs-template and I am trying to adjust it to run my YOLO model.

I adjusted the model name and the image size in utils/predict.ts, and I'm getting the following error:

Uncaught (in promise) Error: resize (packed) does not support mode: 'nearest'
    at l (ort-web.min.js?f1d4:formatted:18144:282536)
    at Object.get (ort-web.min.js?f1d4:formatted:18144:281666)
    at t.WebGLInferenceHandler.executeProgram (ort-web.min.js?f1d4:formatted:18144:209391)
    at t.WebGLInferenceHandler.run (ort-web.min.js?f1d4:formatted:18144:209690)
    at Object.t.resize [as impl] (ort-web.min.js?f1d4:formatted:18144:281598)
    at eval (ort-web.min.js?f1d4:formatted:18144:350066)
    at t.Profiler.event (ort-web.min.js?f1d4:formatted:18144:365260)
    at eval (ort-web.min.js?f1d4:formatted:18144:350026)

Any thing to do to work around this?

lizozom commented 2 years ago

This forked repo can be used to reproduce the issue https://github.com/lizozom/onnxruntime-nextjs-template