google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://mediapipe.dev
Apache License 2.0
26.8k stars 5.09k forks source link

How to change the delegate #4225

Closed Mr-Khans closed 1 year ago

Mr-Khans commented 1 year ago

INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

Is it possible to change the XNNPACK delegate and will it run on the GPU instead of the CPU?

ayushgdev commented 1 year ago

@Mr-Khans You can change the delegate of a calculator by changing the delegate option in any supported calculator. For example, in the hand_landmark_cpu.pbtxt file, you can change the xnnpack to gpu in InferenceCalculator by changing the delegate keyword's value.

However, this is NOT possible in case of Javascript solutions since for them, the graphs are prebuilt. For C++, Python and other solutions, since you need to rebuild the changes, the altered graphs will be recognized.

Mr-Khans commented 1 year ago

@ayushgdev where can i find a quick overview of how to do this for python, I understand that C++ and Cmake are required?

Mr-Khans commented 1 year ago

@ayushgdev image

used: -pip install mediapipe (hand_landmark_cpu.pbtxt)) this file is not in module mediapipe (\mediapipe\modules\hand_landmark)

ayushgdev commented 1 year ago

For making the change to delegate, you need to clone the MediaPipe repo and then go to the file/the graph (for example hand_tracking_cpu.pbtxt) in which there is the calculator (like InferenceCalculator) for which you want to assign the delegate. Then, you need to build the python libs again using the tutorial here. You cannot edit the prebuilt python package installed via pip install....

Mr-Khans commented 1 year ago

Hello @ayushgdev, I get the following information

2023-04-03 22:53:09.463129: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/alex/.local/lib/python3.10/site-packages/cv2/../../lib64:
2023-04-03 22:53:09.463192: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2023-04-03 22:53:10.545148: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:922] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-04-03 22:53:10.545267: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/alex/.local/lib/python3.10/site-packages/cv2/../../lib64:
2023-04-03 22:53:10.545328: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcublas.so.11'; dlerror: libcublas.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/alex/.local/lib/python3.10/site-packages/cv2/../../lib64:
2023-04-03 22:53:10.545389: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcublasLt.so.11'; dlerror: libcublasLt.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/alex/.local/lib/python3.10/site-packages/cv2/../../lib64:
2023-04-03 22:53:10.545453: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcufft.so.10'; dlerror: libcufft.so.10: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/alex/.local/lib/python3.10/site-packages/cv2/../../lib64:
2023-04-03 22:53:10.545517: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcurand.so.10'; dlerror: libcurand.so.10: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/alex/.local/lib/python3.10/site-packages/cv2/../../lib64:
2023-04-03 22:53:10.545577: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcusolver.so.11'; dlerror: libcusolver.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/alex/.local/lib/python3.10/site-packages/cv2/../../lib64:
2023-04-03 22:53:10.545638: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcusparse.so.11'; dlerror: libcusparse.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/alex/.local/lib/python3.10/site-packages/cv2/../../lib64:
2023-04-03 22:53:10.545702: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudnn.so.8'; dlerror: libcudnn.so.8: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/alex/.local/lib/python3.10/site-packages/cv2/../../lib64:
2023-04-03 22:53:10.545733: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1850] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

And why does the skip message appear "Skipping registering GPU devices" , and use CPU? I want to use GPU only.

Mr-Khans commented 1 year ago

@ayushgdev you link not work https://google.github.io/mediapipe/getting_started/python.html#building-mediapipe-python-package

Mr-Khans commented 1 year ago

Hi @ayushgdev Please give access to link https://google.github.io/mediapipe/getting_started/python.html#building-mediapipe-python-package

ayushgdev commented 1 year ago

Hello @Mr-Khans From the error log, it looks like your setup with GPU is not working and MediaPipe is not able to load CUDA libraries. Would you please check if you have followed the General Installation Guide, Python Setup and GPU Support Guide?

Mr-Khans commented 1 year ago

@ayushgdev I do everything according to the Guide

bash build_desktop_examples.sh

ERROR: Analysis of target '//mediapipe/examples/desktop/face_detection:face_detection_cpu' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.342s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 163 targets configured)
    currently loading: mediapipe/modules/face_detection ... (3 packages)
ayushgdev commented 1 year ago

@Mr-Khans There is a duplicate issue opened by you #4246 for this error on build_desktop_examples.sh file. Is your original query on the delegate change resolved? We have also provided the correct links for Python build as requested here. If yes, we shall close this issue and follow up on #4246 to keep to keep the context of the issue as relevant to the original issue as possible. This helps community and us to search the issues better in concise manner.

Mr-Khans commented 1 year ago

@ayushgdev you never answered the question about running bash build_desktop_examples.sh in a separate thread.

bash build_desktop_examples.sh                         
app_dir: mediapipe/examples/desktop
out_dir: .
=== Target: mediapipe/examples/desktop/face_detection:face_detection_cpu
build_desktop_examples.sh: line 86: bazelisk: command not found

I want to run a delegate that can use the GPU, but your answer does not help me, it still works with the CPU and GPU skipping.

Doing everything according to the instructions does not help .

How to use pbtxt in the module folder? why does the hand_tracking/BUILD folder not work

how to use pbtxt in the module folder? why does the hand_tracking/BUILD folder not work

licenses(["notice"])

package(default_visibility = ["//mediapipe/examples:__subpackages__"])

cc_binary(
    name = "hand_tracking_tflite",
    data = [
        "//mediapipe/modules/hand_landmark:hand_landmark_full.tflite",
        "//mediapipe/modules/palm_detection:palm_detection_full.tflite",
    ],
    deps = [
        "//mediapipe/examples/desktop:simple_run_graph_main",
        "//mediapipe/graphs/hand_tracking:desktop_tflite_calculators",
    ],
)

cc_binary(
    name = "hand_tracking_cpu",
    data = [
        "//mediapipe/modules/hand_landmark:hand_landmark_full.tflite",
        "//mediapipe/modules/palm_detection:palm_detection_full.tflite",
    ],
    deps = [
        "//mediapipe/examples/desktop:demo_run_graph_main",
        "//mediapipe/graphs/hand_tracking:desktop_tflite_calculators",
    ],
)

# Linux only
cc_binary(
    name = "hand_tracking_gpu",
    data = [
        "//mediapipe/modules/hand_landmark:hand_landmark_full.tflite",
        "//mediapipe/modules/palm_detection:palm_detection_full.tflite",
    ],
    deps = [
        "//mediapipe/examples/desktop:demo_run_graph_main_gpu",
        "//mediapipe/graphs/hand_tracking:mobile_calculators",
    ],
)

Am I running it wrong?

bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu
ayushgdev commented 1 year ago

@Mr-Khans The error "build_desktop_examples.sh: line 86: bazelisk: command not found" indicates the bazel is not installed and hence it is not able to proceed. Please install bazel first. Bazel is the cross compilation tool used to compile mediapipe project and Bazelisk is a wrapper for Bazel which can automatically pick the version of bazel you want to use specific to your project (for example, in mediapipe 5.2.0 is the default bazel version in v0.9.2.1). This is given as the first step in the Installation docs or you can go directly here.

Also, are you using WSL with ubuntu in windows?

Mr-Khans commented 1 year ago

hi @ayushgdev Now I used OS Ubuntu 18.04 и bazel-5.2.0 not WSL gcc (Ubuntu 7.5.0-3ubuntu1~18.04) - 7.5.0

test_mediapipe/new_m/mediapipe/mediapipe/gpu/BUILD:205:11: Compiling mediapipe/gpu/gl_texture_buffer.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 51 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from ./mediapipe/gpu/gl_texture_view.h:23:0,
                 from ./mediapipe/gpu/gl_texture_buffer.h:27,
                 from mediapipe/gpu/gl_texture_buffer.cc:15:
./mediapipe/gpu/gpu_buffer_storage.h: In instantiation of 'mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&)::<lambda(std::shared_ptr<mediapipe::internal::GpuBufferStorage>)> [with StorageFrom = mediapipe::GlTextureBuffer; StorageTo = mediapipe::GpuBufferStorageImageFrame; F = std::shared_ptr<mediapipe::GpuBufferStorageImageFrame> (&)(std::shared_ptr<mediapipe::GlTextureBuffer>)]':
./mediapipe/gpu/gpu_buffer_storage.h:112:10:   required from 'struct mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GlTextureBuffer; StorageTo = mediapipe::GpuBufferStorageImageFrame; F = std::shared_ptr<mediapipe::GpuBufferStorageImageFrame> (&)(std::shared_ptr<mediapipe::GlTextureBuffer>)]::<lambda(class std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>'
./mediapipe/gpu/gpu_buffer_storage.h:116:67:   required from 'mediapipe::internal::GpuBufferStorageRegistry::RegistryToken mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GlTextureBuffer; StorageTo = mediapipe::GpuBufferStorageImageFrame; F = std::shared_ptr<mediapipe::GpuBufferStorageImageFrame> (&)(std::shared_ptr<mediapipe::GlTextureBuffer>)]'
mediapipe/gpu/gl_texture_buffer.cc:355:32:   required from here
./mediapipe/gpu/gpu_buffer_storage.h:113:50: error: variable 'converter' has function type
             -> std::shared_ptr<GpuBufferStorage> {
                                                  ^
./mediapipe/gpu/gpu_buffer_storage.h:113:50: error: variable 'converter' has function type
./mediapipe/gpu/gpu_buffer_storage.h: In instantiation of 'struct mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GlTextureBuffer; StorageTo = mediapipe::GpuBufferStorageImageFrame; F = std::shared_ptr<mediapipe::GpuBufferStorageImageFrame> (&)(std::shared_ptr<mediapipe::GlTextureBuffer>)]::<lambda(class std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>':
./mediapipe/gpu/gpu_buffer_storage.h:116:67:   required from 'mediapipe::internal::GpuBufferStorageRegistry::RegistryToken mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GlTextureBuffer; StorageTo = mediapipe::GpuBufferStorageImageFrame; F = std::shared_ptr<mediapipe::GpuBufferStorageImageFrame> (&)(std::shared_ptr<mediapipe::GlTextureBuffer>)]'
mediapipe/gpu/gl_texture_buffer.cc:355:32:   required from here
./mediapipe/gpu/gpu_buffer_storage.h:112:10: error: field 'mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GlTextureBuffer; StorageTo = mediapipe::GpuBufferStorageImageFrame; F = std::shared_ptr<mediapipe::GpuBufferStorageImageFrame> (&)(std::shared_ptr<mediapipe::GlTextureBuffer>)]::<lambda(std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>::<converter capture>' invalidly declared function type
         [converter](std::shared_ptr<GpuBufferStorage> source)
          ^~~~~~~~~
./mediapipe/gpu/gpu_buffer_storage.h: In instantiation of 'mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&)::<lambda(std::shared_ptr<mediapipe::internal::GpuBufferStorage>)> [with StorageFrom = mediapipe::GpuBufferStorageImageFrame; StorageTo = mediapipe::GlTextureBuffer; F = std::shared_ptr<mediapipe::GlTextureBuffer> (&)(std::shared_ptr<mediapipe::GpuBufferStorageImageFrame>)]':
./mediapipe/gpu/gpu_buffer_storage.h:112:10:   required from 'struct mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GpuBufferStorageImageFrame; StorageTo = mediapipe::GlTextureBuffer; F = std::shared_ptr<mediapipe::GlTextureBuffer> (&)(std::shared_ptr<mediapipe::GpuBufferStorageImageFrame>)]::<lambda(class std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>'
./mediapipe/gpu/gpu_buffer_storage.h:116:67:   required from 'mediapipe::internal::GpuBufferStorageRegistry::RegistryToken mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GpuBufferStorageImageFrame; StorageTo = mediapipe::GlTextureBuffer; F = std::shared_ptr<mediapipe::GlTextureBuffer> (&)(std::shared_ptr<mediapipe::GpuBufferStorageImageFrame>)]'
mediapipe/gpu/gl_texture_buffer.cc:359:34:   required from here
./mediapipe/gpu/gpu_buffer_storage.h:113:50: error: variable 'converter' has function type
             -> std::shared_ptr<GpuBufferStorage> {
                                                  ^
./mediapipe/gpu/gpu_buffer_storage.h:113:50: error: variable 'converter' has function type
./mediapipe/gpu/gpu_buffer_storage.h: In instantiation of 'struct mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GpuBufferStorageImageFrame; StorageTo = mediapipe::GlTextureBuffer; F = std::shared_ptr<mediapipe::GlTextureBuffer> (&)(std::shared_ptr<mediapipe::GpuBufferStorageImageFrame>)]::<lambda(class std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>':
./mediapipe/gpu/gpu_buffer_storage.h:116:67:   required from 'mediapipe::internal::GpuBufferStorageRegistry::RegistryToken mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GpuBufferStorageImageFrame; StorageTo = mediapipe::GlTextureBuffer; F = std::shared_ptr<mediapipe::GlTextureBuffer> (&)(std::shared_ptr<mediapipe::GpuBufferStorageImageFrame>)]'
mediapipe/gpu/gl_texture_buffer.cc:359:34:   required from here
./mediapipe/gpu/gpu_buffer_storage.h:112:10: error: field 'mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GpuBufferStorageImageFrame; StorageTo = mediapipe::GlTextureBuffer; F = std::shared_ptr<mediapipe::GlTextureBuffer> (&)(std::shared_ptr<mediapipe::GpuBufferStorageImageFrame>)]::<lambda(std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>::<converter capture>' invalidly declared function type
         [converter](std::shared_ptr<GpuBufferStorage> source)
          ^~~~~~~~~
In file included from /usr/include/c++/7/functional:58:0,
                 from external/com_google_absl/absl/meta/type_traits.h:39,
                 from external/com_google_absl/absl/memory/memory.h:34,
                 from ./mediapipe/gpu/gl_texture_buffer.h:23,
                 from mediapipe/gpu/gl_texture_buffer.cc:15:
/usr/include/c++/7/bits/std_function.h:685:7: error: 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GlTextureBuffer; StorageTo = mediapipe::GpuBufferStorageImageFrame; F = std::shared_ptr<mediapipe::GpuBufferStorageImageFrame> (&)(std::shared_ptr<mediapipe::GlTextureBuffer>)]::<lambda(std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = std::shared_ptr<mediapipe::internal::GpuBufferStorage>; _ArgTypes = {std::shared_ptr<mediapipe::internal::GpuBufferStorage>}]', declared using local type 'mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GlTextureBuffer; StorageTo = mediapipe::GpuBufferStorageImageFrame; F = std::shared_ptr<mediapipe::GpuBufferStorageImageFrame> (&)(std::shared_ptr<mediapipe::GlTextureBuffer>)]::<lambda(std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>', is used but never defined [-fpermissive]
       function<_Res(_ArgTypes...)>::
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/std_function.h:685:7: error: 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GpuBufferStorageImageFrame; StorageTo = mediapipe::GlTextureBuffer; F = std::shared_ptr<mediapipe::GlTextureBuffer> (&)(std::shared_ptr<mediapipe::GpuBufferStorageImageFrame>)]::<lambda(std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = std::shared_ptr<mediapipe::internal::GpuBufferStorage>; _ArgTypes = {std::shared_ptr<mediapipe::internal::GpuBufferStorage>}]', declared using local type 'mediapipe::internal::GpuBufferStorageRegistry::RegisterConverter(F&&) [with StorageFrom = mediapipe::GpuBufferStorageImageFrame; StorageTo = mediapipe::GlTextureBuffer; F = std::shared_ptr<mediapipe::GlTextureBuffer> (&)(std::shared_ptr<mediapipe::GpuBufferStorageImageFrame>)]::<lambda(std::shared_ptr<mediapipe::internal::GpuBufferStorage>)>', is used but never defined [-fpermissive]
Target //mediapipe/examples/desktop/hello_world:hello_world failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 41.278s, Critical Path: 33.54s
INFO: 278 processes: 130 internal, 148 linux-sandbox.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Am I running it wrong?

bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu

I used this run:

bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu

ERROR:

ERROR: test_mediapipe/new_m/mediapipe/mediapipe/gpu/BUILD:149:11: Compiling mediapipe/gpu/gl_context_egl.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 53 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from mediapipe/gpu/gl_context_egl.cc:24:0:
./mediapipe/gpu/gl_context.h:249:3: error: 'GlVersion' does not name a type
   GlVersion GetGlVersion() const;
   ^~~~~~~~~
./mediapipe/gpu/gl_context.h:486:7: error: 'GlTextureInfo' does not name a type
 const GlTextureInfo& GlTextureInfoForGpuBufferFormat(GpuBufferFormat format,
       ^~~~~~~~~~~~~
Target //mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.622s, Critical Path: 3.75s
INFO: 157 processes: 139 internal, 18 linux-sandbox.
FAILED: Build did NOT complete successfully

You can throw off the full list of installation recommendations, including the version of ubuntu and additional libraries and python?

ayushgdev commented 1 year ago

Hello @Mr-Khans The command you are using asks MediaPipe to disable GPU, but then you are targetting the gpu version of hand tracking for compilation. Hence the error arose. You need to use the hand_tracking_cpu target. Check this section for compilation and running of examples. For the installation recommendations, please follow the given documentations in the same order:

For the versions of the deps installed, check the following:

Also, before going for the GPU specific apps, please compile the CPU versions first. This will help eliminate lots of errors which might be unrelated to GPU.

Mr-Khans commented 1 year ago

Hola @ayushgdev )

Now works on the GPU delegate, but the question arose why these messages "VERBOSE: Replacing 272 node(s) with delegate (TfLiteGpuDelegate) node, yielding 1 partitions for the whole graph. and VERBOSE: Replacing 165 node(s) with delegate (TfLiteGpuDelegate) node, yielding 1 partitions for the whole graph." appear. For the test, I compiled a version on the CPU and it turned out that the CPU version works faster than on the GPU. How did it happen

I20230419 19:33:30.286103  6530 demo_run_graph_main_gpu.cc:60] Initialize the calculator graph.
I20230419 19:33:30.297260  6530 demo_run_graph_main_gpu.cc:64] Initialize the GPU.
I20230419 19:33:30.317270  6530 gl_context_egl.cc:84] Successfully initialized EGL. Major : 1 Minor: 4
I20230419 19:33:30.322064  6579 gl_context.cc:342] GL version: 3.1 (OpenGL ES 3.1 Mesa 20.0.8)
I20230419 19:33:30.322258  6530 demo_run_graph_main_gpu.cc:70] Initialize the camera or load the video.
I20230419 19:33:30.365832  6530 demo_run_graph_main_gpu.cc:91] Start running the calculator graph.
I20230419 19:33:30.371165  6530 demo_run_graph_main_gpu.cc:96] Start grabbing and processing frames.
INFO: Initialized TensorFlow Lite runtime.
INFO: Created TensorFlow Lite delegate for GPU.
VERBOSE: Replacing 272 node(s) with delegate (TfLiteGpuDelegate) node, yielding 1 partitions for the whole graph.
VERBOSE: Replacing 165 node(s) with delegate (TfLiteGpuDelegate) node, yielding 1 partitions for the whole graph.
I20230419 19:33:50.652287  6530 demo_run_graph_main_gpu.cc:173] Prepare video writer.
I20230419 19:34:37.717270  6530 demo_run_graph_main_gpu.cc:107] Empty frame, end of video reached.
I20230419 19:34:37.717321  6530 demo_run_graph_main_gpu.cc:188] Shutting down.
I20230419 19:34:38.090206  6530 demo_run_graph_main_gpu.cc:205] Success!
ayushgdev commented 1 year ago

This is a different issue altogether @Mr-Khans . For this, please open a separate issue. The original issue has been addressed.

Mr-Khans commented 1 year ago

Okay) THX)

google-ml-butler[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No

Neilblaze commented 1 year ago

@ayushgdev, @kuaashish I'm using MediaPipe tasks-vision JS API (web) to replicate this in another app on my local using the provided codepen example. Is there any way to inspect the delegate? (whether it's set on GPU or CPU?)

> Also refer to this.

UPDATE: Solved