Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"posenet_decoder" for Windows #22

Open
baghbidi opened this issue May 31, 2022 · 10 comments
Open

"posenet_decoder" for Windows #22

baghbidi opened this issue May 31, 2022 · 10 comments
Assignees
Labels
Hardware:USB Accelerator Coral USB Accelerator issues stat:contributions welcome Status - Contributions welcome subtype:windows Windos Build/installation issues type:feature Feature requests type:support Support question or issue

Comments

@baghbidi
Copy link

baghbidi commented May 31, 2022

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

@google-coral-bot google-coral-bot bot added Hardware:USB Accelerator Coral USB Accelerator issues subtype:windows Windos Build/installation issues type:feature Feature requests type:support Support question or issue labels May 31, 2022
@hjonnala
Copy link

hjonnala commented Jun 2, 2022

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

@baghbidi
Copy link
Author

baghbidi commented Jun 2, 2022

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

Thanks!

@baghbidi
Copy link
Author

baghbidi commented Jun 8, 2022

@hjonnala Any updates?

@hjonnala
Copy link

hjonnala commented Jun 8, 2022

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
Copy link
Author

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

@hjonnala
Copy link

hjonnala commented Jun 22, 2022

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

@baghbidi
Copy link
Author

baghbidi commented Jun 22, 2022

Built it on Windows:

  • Switched to release-frogfish tag in libcoral repo
  • Switched to release-frogfish tag in libedgetpu submodule
  • Added the below to libcoral\coral\posenet\BUILD:
cc_binary(
    name = "posenet_decoder.dll",
    srcs = ["posenet_decoder_tflite_plugin.cc"],
    linkshared = 1,
    deps = [
        ":posenet_decoder_op",
        "@org_tensorflow//tensorflow/lite:kernel_api",
        "@org_tensorflow//tensorflow/lite:util",
    ],
)
  • and finally built it using this command:
    bazel build coral/posenet:posenet_decoder.dll --experimental_repo_remote_exec --incompatible_restrict_string_escapes=false

@hjonnala
Copy link

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.

@hjonnala hjonnala added the stat:contributions welcome Status - Contributions welcome label Jun 23, 2022
@baghbidi
Copy link
Author

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
Copy link
Author

baghbidi commented Jul 6, 2022

@hjonnala any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hardware:USB Accelerator Coral USB Accelerator issues stat:contributions welcome Status - Contributions welcome subtype:windows Windos Build/installation issues type:feature Feature requests type:support Support question or issue
Projects
None yet
Development

No branches or pull requests

2 participants