asus4 / tf-lite-unity-sample

TensorFlow Lite Samples on Unity
834 stars 249 forks source link

DllNotFoundException: libtensorflowlite_c #276

Closed fredmouse closed 1 year ago

fredmouse commented 1 year ago

Environment (please complete the following information):

Describe the bug Couldn't run any example as all prompts the same DllNotFoundException: libtensorflowlite_c exception. I cloned the git with Git-LFS installed, which ended up with almost over 800mb and libtensorflowlite_c.dll of 3mb( I think I didn't miss any files). But I still get this exception on all the examples. Below you can find one of the exception message

DllNotFoundException: libtensorflowlite_c assembly: type: member:(null) TensorFlowLite.InterpreterOptions..ctor () (at Packages/com.github.asus4.tflite/Runtime/InterpreterOptions.cs:62) TensorFlowLite.BaseImagePredictor1[T].CreateOptions (TensorFlowLite.BaseImagePredictor1+Accelerator[T] accelerator) (at Packages/com.github.asus4.tflite.common/Runtime/BaseImagePredictor.cs:104) TensorFlowLite.BaseImagePredictor1[T]..ctor (System.String modelPath, TensorFlowLite.BaseImagePredictor1+Accelerator[T] accelerator) (at Packages/com.github.asus4.tflite.common/Runtime/BaseImagePredictor.cs:98) TensorFlowLite.FaceDetect..ctor (System.String modelPath) (at Assets/Samples/FaceMesh/FaceDetect.cs:48) FaceDetectionSample.Start () (at Assets/Samples/FaceMesh/FaceDetectionSample.cs:27)

asus4 commented 1 year ago

@fredmouse Can you check this out? https://github.com/asus4/tf-lite-unity-sample/issues/199#issuecomment-1058950494

On the macOS, please confirm that dylibs are exists at Packages/com.github.asus4.tflite/Plugins/macOS/*.dylib.

fredmouse commented 1 year ago

I checked every post on this DllNotFoundException topic before posting this issue. I tried these methods like brew install git-lfs and git clone this repository. I also executed "git lfs install" in the cloned folder afterwards. On the other hand, I confirm I have libtensorflowlite_c.dylib and libtensorflowlite_metal_delegate.dylib at Packages/com.github.asus4.tflite/Plugins/macOS/*.dylib.

@fredmouse Can you check this out? #199 (comment)

On the macOS, please confirm that dylibs are exists at Packages/com.github.asus4.tflite/Plugins/macOS/*.dylib.

asus4 commented 1 year ago

Hmmm...then I have no idea to solve your error.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

fushikky commented 12 months ago

I got same error. But I realise my mistake. (My OS is intel Mac[macOS13.4].)

I opened the library in notepad. (Packages/com.github.asus4.tflite/Plugins/macOS/libtensorflowlite_c.dylib) In my case it was a reference file to the Git LFS.

I ran a command (git lfs pull) and the dll entity was downloaded and worked fine.

I hope this helps you.

HoopyGame commented 5 months ago

When I use Unity to build Android, DllNotFoundException: libtensorflowlite will appear_ JNI error;

Unity version: March 14, 2022

Android Level: 7

Il2cpp