cj-mills / onnx-directml-unity-tutorial

This tutorial covers creating an object detection plugin for a Unity game engine project using ONNX Runtime and DirectML.
https://christianjmills.com/posts/onnx-directml-unity-tutorial/part-1/
MIT License
16 stars 1 forks source link

DllNotFoundException: ONNX_YOLOX_DLL assembly: type: member:(null) #2

Closed ilanb closed 1 year ago

ilanb commented 1 year ago

Hi, Tried to use on Unity OSX 2021.3.5f1 error when I play in editor, all DLL placed in plugin folder like tutorial (Assets/Plugins/x86_64/ONNX_YOLOX_DLL.dll)

DllNotFoundException: ONNX_YOLOX_DLL assembly: type: member:(null) ObjectDetector.UploadTexture (UnityEngine.Texture2D texture) (at Assets/_MAIN/_ONNX-YOLOX/Scripts/ObjectDetector.cs:553) ObjectDetector.Update () (at Assets/_MAIN/_ONNX-YOLOX/Scripts/ObjectDetector.cs:680)

Regards,

cj-mills commented 1 year ago

Hi @ilanb, As mentioned in the associated blog post, DirectML is a DirectX 12 Windows library. Consequently, the plug-in for this project is for Windows devices only.

I do not have a Mac, so I can't make Mac-specific tutorials. The closest I have for a Mac user is this tutorial, which uses TensorFlow.js in a WebGL project.

You might want to look into the CoreML execution provider for ONNX Runtime and investigate how to make a Unity plug-in for macOS/iOS.

ilanb commented 1 year ago

Hi Christian,

Thanks for quick reply and tips, Actualy I trying TensorFlowSharp, ML-Agents (liblibtensorflow), with yolov2_tiny, ssd_mobilenet and mobilenet_v1_1.0_224 models, work on editor (OSX) but when I build for linux is not working. My question is about linux because I already created a application with opencv for images featuring2D detection and a REST api to call it. (All work Fine) but I need to integrate an object detection feature…

First do you know something (object recognition) working on linux made by unity ? Second how to train custom model for it ?

Third, do you interested to work as freelance on this project ?

Regards, Ilan

Le 6 déc. 2022 à 18:52, Christian J. Mills @.***> a écrit :

Hi @ilanb https://github.com/ilanb, As mentioned in the associated blog post https://christianjmills.com/posts/onnx-directml-unity-tutorial/part-1/#introduction, DirectML is a DirectX 12 Windows library. Consequently, the plug-in for this project is for Windows devices only.

I do not have a Mac, so I can't make Mac-specific tutorials. The closest I have for a Mac user is this tutorial, which uses TensorFlow.js in a WebGL project.

In-Browser Object Detection for Unity with TensorFlow.js https://christianjmills.com/posts/tfjs-yolox-unity-tutorial/ You might want to look into the CoreML execution provider for ONNX Runtime and investigate how to make a Unity plug-in for macOS/iOS.

CoreML Execution Provider https://onnxruntime.ai/docs/execution-providers/CoreML-ExecutionProvider.html macOS plug-ins https://docs.unity3d.com/Manual/PluginsForDesktop.html Building plug-ins for iOS https://docs.unity3d.com/Manual/PluginsForIOS.html — Reply to this email directly, view it on GitHub https://github.com/cj-mills/onnx-directml-unity-tutorial/issues/2#issuecomment-1339753595, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGYTPMM2HNCYA2INRUBPUTWL54ODANCNFSM6AAAAAASVRAHEM. You are receiving this because you were mentioned.

cj-mills commented 1 year ago

Hi Ilan, For your first question, the only object detection sample I know of provided by Unity is the YOLOv3-tiny model in their Barracuda Starter Kit. I have not tested it on Linux, but that has as good a chance of working as any.

For your second question, you can check out the yolov3 GitHub repository by Ultralytics for training. Although, you might need to make modifications to the model to make it compatible with Unity's Barracuda inference library.

You can also follow my training tutorial to finetune the YOLOX Tiny model from my project on a custom dataset.

This tutorial from another site provides a basic example of making cross-platform native plugins for Unity, including Linux.

I, unfortunately, can't take on additional projects at the moment.