google-coral / libcoral

C++ API for ML inferencing and transfer-learning on Coral devices
https://coral.ai
Apache License 2.0
78 stars 42 forks source link

"posenet_decoder" for Windows #22

Open baghbidi opened 2 years ago

baghbidi commented 2 years ago

Description

Hello.

I have been looking for the DLL version of posenet_decoder for Windows but since I couldn't find it online, I decided to build it using bazel. Added this section to coral/pose_estimation/BUILD

cc_binary(
    name = "posenet_decoder.dll",
    srcs = ["posenet_decoder_tflite_plugin.cc"],
    linkopts = [
          "-Wl,@rpath/posenet_decoder.dll",
    ],
    linkshared = 1,
    deps = [
        ":posenet_decoder_op",
        "@org_tensorflow//tensorflow/lite:kernel_api",
        "@org_tensorflow//tensorflow/lite:util",
    ],
)

It gives me a DLL file but I cannot load it with load_delegate and getting this error:

Traceback (most recent call last):
  File ".\coral.py", line 32, in <module>
    posenet_decoder_delegate = load_delegate(posenet_shared_lib)
  File "C:\Python37\lib\site-packages\tflite_runtime\interpreter.py", line 160, in load_delegate
    delegate = Delegate(library, options)
  File "C:\Python37\lib\site-packages\tflite_runtime\interpreter.py", line 93, in __init__      
    ctypes.CFUNCTYPE(None, ctypes.c_char_p)
  File "C:\Python37\lib\ctypes\__init__.py", line 377, in __getattr__
    func = self.__getitem__(name)
  File "C:\Python37\lib\ctypes\__init__.py", line 382, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'tflite_plugin_create_delegate' not found
Exception ignored in: <function Delegate.__del__ at 0x000001BCCA7268B8>
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\tflite_runtime\interpreter.py", line 125, in __del__      
    self._library.tflite_plugin_destroy_delegate.argtypes = [ctypes.c_void_p]
  File "C:\Python37\lib\ctypes\__init__.py", line 377, in __getattr__
    func = self.__getitem__(name)
  File "C:\Python37\lib\ctypes\__init__.py", line 382, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'tflite_plugin_destroy_delegate' not found

Any idea how I could solve this issue?

Click to expand! ### Issue Type Support, Feature Request ### Operating System Windows 10 ### Coral Device USB Accelerator ### Other Devices _No response_ ### Programming Language Python 3.7 ### Relevant Log Output _No response_
hjonnala commented 2 years ago

Hello @baghbidi can you please share the posenet_shared_lib.dll file here. Thanks!

baghbidi commented 2 years ago

@hjonnala, here is the compiled DLL: posenet_decoder.dll.zip

Thanks!

baghbidi commented 2 years ago

@hjonnala Any updates?

hjonnala commented 2 years ago

edgetpu rutime 14 does not work on windows. So can you please try with release-frogfish and share the build instructions here: https://github.com/google-coral/libcoral/tags

Thanks!

baghbidi commented 2 years ago

Hey @hjonnala. Compiled it with frogfish release and still getting the same error

hjonnala commented 2 years ago

Have you compiled it on Windows Machine or MacOS? Can you please share the build instruction steps to reproduce the issue.. Thanks!

baghbidi commented 2 years ago

Built it on Windows:

hjonnala commented 2 years ago

I have tried to build posenet decoder on Windows similar to what we did for MacOS. Unfortunately, I am not able to build it successfully due to incomplete build setup on Windows.

baghbidi commented 2 years ago

Looking at the error, seems like you're missing some prerequisites: The target you are compiling requires Visual C++ build tools You can follow the instructions here:

https://docs.bazel.build/versions/main/install-windows.html
https://docs.bazel.build/versions/main/windows.html#build-on-windows

I am using Bazel 4.2.1

baghbidi commented 2 years ago

@hjonnala any updates?