Enable VX Delegate on Linux 6.1.55-3.0 IMX8PLUS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enable VX Delegate on Linux 6.1.55-3.0 IMX8PLUS

257 Views
ken11
Contributor I

Hi Team,

I am trying to enable VX Delegate running yolov5s using python script. I used the given sample label_image.py with --ext_delegate=/usr/lib/libvx_delegate.so and I got this error:

Loading external delegate from /usr/lib/libvx_delegate.so with args: {}

Traceback (most recent call last):

  File "/home/compulab/tensorflow-imx/tensorflow/lite/examples/python/label_image.py", line 85, in <module>

    tflite.load_delegate(args.ext_delegate, ext_delegate_options)

  File "/usr/local/lib/python3.10/site-packages/tflite_runtime/interpreter.py", line 166, in load_delegate

    delegate = Delegate(library, options)

  File "/usr/local/lib/python3.10/site-packages/tflite_runtime/interpreter.py", line 74, in __init__

    self._library.tflite_plugin_create_delegate.argtypes = [

  File "/usr/local/lib/python3.10/ctypes/__init__.py", line 387, in __getattr__

    func = self.__getitem__(name)

  File "/usr/local/lib/python3.10/ctypes/__init__.py", line 392, in __getitem__

    func = self._FuncPtr((name_or_ordinal, self))

AttributeError: /usr/lib/libvx_delegate.so: undefined symbol: tflite_plugin_create_delegate

Exception ignored in: <function Delegate.__del__ at 0xffff7f286c20>

Traceback (most recent call last):

  File "/usr/local/lib/python3.10/site-packages/tflite_runtime/interpreter.py", line 110, in __del__

    self._library.tflite_plugin_destroy_delegate.argtypes = [ctypes.c_void_p]

  File "/usr/local/lib/python3.10/ctypes/__init__.py", line 387, in __getattr__

    func = self.__getitem__(name)

  File "/usr/local/lib/python3.10/ctypes/__init__.py", line 392, in __getitem__

    func = self._FuncPtr((name_or_ordinal, self))

AttributeError: /usr/lib/libvx_delegate.so: undefined symbol: tflite_plugin_destroy_delegate

 

Am I not building the libvx_delegate library properly? I built the library and moved it to /usr/lib

Here is the log:

imx8mp:~/tensorflow-imx/tensorflow/lite/delegates/external$ bazelisk build :external_delegate WARNING: while reading option defaults file '/home/compulab/tensorflow-imx/.bazelrc': invalid command name 'startup:windows'. INFO: Options provided by the client: Inherited 'common' options: --isatty=1 --terminal_columns=100 INFO: Reading rc options for 'build' from /home/compulab/tensorflow-imx/.bazelrc: Inherited 'common' options: --experimental_repo_remote_exec INFO: Reading rc options for 'build' from /home/compulab/tensorflow-imx/.bazelrc: 'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --features=-force_no_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility INFO: Found applicable config definition build:short_logs in file /home/compulab/tensorflow-imx/.bazelrc: --output_filter=DONT_MATCH_ANYTHING INFO: Found applicable config definition build:v2 in file /home/compulab/tensorflow-imx/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1 INFO: Found applicable config definition build:linux in file /home/compulab/tensorflow-imx/.bazelrc: --host_copt=-w --copt=-Wno-all --copt=-Wno-extra --copt=-Wno-deprecated --copt=-Wno-deprecated-declarations --copt=-Wno-ignored-attributes --copt=-Wno-array-bounds --copt=-Wunused-result --copt=-Werror=unused-result --copt=-Wswitch --copt=-Werror=switch --copt=-Wno-error=unused-but-set-variable --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --config=dynamic_kernels --experimental_guard_against_concurrent_changes INFO: Found applicable config definition build:dynamic_kernels in file /home/compulab/tensorflow-imx/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/668e33c640... failed: class java.io.FileNotFoundException GET returned 404 Not Found WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/769f5cc9b... failed: class java.io.FileNotFoundException GET returned 404 Not Found WARNING: while reading option defaults file '/home/compulab/tensorflow-imx/.bazelrc': invalid command name 'startup:windows'. WARNING: Download from https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/081771d4a0e9d7d3aa0eed2ef389fa4700... failed: class java.io.FileNotFoundException GET returned 404 Not Found INFO: Analyzed target //tensorflow/lite/delegates/external:external_delegate (57 packages loaded, 313 targets configured). INFO: Found 1 target... Target //tensorflow/lite/delegates/external:external_delegate up-to-date: bazel-bin/tensorflow/lite/delegates/external/libexternal_delegate.a bazel-bin/tensorflow/lite/delegates/external/libexternal_delegate.pic.a bazel-bin/tensorflow/lite/delegates/external/libexternal_delegate.so INFO: Elapsed time: 56.938s, Critical Path: 3.25s INFO: 12 processes: 4 internal, 8 local. INFO: Build completed successfully, 12 total actions

 

 

 

0 Kudos
Reply
1 Reply

218 Views
brian14
NXP TechSupport
NXP TechSupport

Hi @ken11

Thank you for contacting NXP Support.

The libvx_delegate it's part of our BSP.
Are you trying to integrate this delegate to a custom board?

0 Kudos
Reply