Closed yangcheng closed 3 years ago
Hi @yangcheng, Could you please share what device/ model are you using to test.
And please share any code changes, if you performed on it with a repo link to understand better. Thanks !
@sgowroji It's a custom pad, based on amlogic 311d and android 9 32 bit. Is there some command I could run to give you more information?
Mlkit vision quickstart (https://github.com/googlesamples/mlkit/tree/master/android/vision-quickstart ) can run just fine.
To help isolate the problem I did not do any change and can still reproduce the issue. I build from my fork https://github.com/yangcheng/mediapipe which is even with current master at a92cff7a60031f5c3097b06e74416732d85b5011
I build with
➜ mediapipe git:(master) ✗ bazel build -c opt --config=android_arm mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetectiongpu
Starting local Bazel server and connecting to it...
DEBUG: /private/var/tmp/_bazel_chengyang/499bcac60d39d6fdb5899bef0a838c2d/external/rules_foreign_cc/workspace_definitions.bzl:6:6: `@rules_foreign_cc//:workspace_definitions.bzl` has been replaced by `@rules_foreign_cc//foreign_cc:repositories.bzl`. Please use the updated source location
DEBUG: /private/var/tmp/_bazel_chengyang/499bcac60d39d6fdb5899bef0a838c2d/external/rules_foreign_cc/tools/build_defs/deprecation.bzl:5:10: `@rules_foreign_cc//tools/build_defs/...` is deprecated, please find the relevant symbols in `@rules_foreign_cc//foreign_cc/...`. Note that the core rules can now be loaded from `@rules_foreign_cc//foreign_cc:defs.bzl`
INFO: Analyzed target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetectiongpu:objectdetectiongpu (171 packages loaded, 15421 targets configured).
INFO: Found 1 target...
Target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetectiongpu:objectdetectiongpu up-to-date:
bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetectiongpu/objectdetectiongpu_deploy.jar
bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetectiongpu/objectdetectiongpu_unsigned.apk
bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetectiongpu/objectdetectiongpu.apk
INFO: Elapsed time: 25.171s, Critical Path: 5.06s
INFO: 5 processes: 1 internal, 1 darwin-sandbox, 3 worker.
INFO: Build completed successfully, 5 total actions
Hi @yangcheng - are you having trouble running other CPU examples as well? For example, does Hand tracking work? Does the basic Hello world Android MediaPipe demo work?
I have trouble with other CPU examples as well.
Hi - does the basic Hello world Android MediaPipe demo work? This app uses an edge detection graph on GPU. You mentioned
objectdectiongpu can open the camera with a longer delay than mlkit. where should I start to debug the problem? Thanks
so I want to know if the camera lag is happening on simple edge detection graph also.
yes, the basic hello world works.
Okay if basic hello world works, then we can confirm that the camera preview works for a simple MediaPipe graph. It's possible that the models are heavy for your device configuration - especially since they don't run on CPU but do work slowly on GPU as described in your comments above. Lets confirm if that is indeed the case. Can you try using https://google.github.io/mediapipe/tools/tracing_and_profiling.html#tracing-on-android to collect traces for ObjectDetectionCPU and ObjectDetectionGPU and share the results on your device here?
Also adding @hadon for discussion about using tracing/profiling to determine if the models are too slow for your device.
Hi @yangcheng, Could you please provide the traces as mentioned in the above comment. Thanks!
I can not reliably reproduce the issue. I'll try more time today and see if I can get anything
Hi @yangcheng, Did you get a chance to reproduce the above issue. Thanks!
Hi @yangcheng, Could you please respond to my above comment. Thanks!
sorry for the late reply, we had a national holiday last week. I reproduced it once. I'll try to get the trace
it's unclear to me where to add the profiler config. the doc says
Add the following protobuf message into the existing calculator-graph-config protobuf, such as the existing .pbtxt file. Follow the instructions stated above in Enable tracing
but there is no following message.
I think the doc attempts to refer to the profiler_config message in the section "Enabling tracing and profiling", to avoid repeating that example protobuf message in two sections. It instead should say "add the above ProfilerConfig protobuf message". The config should look like:
profiler_config {
trace_enabled: true
enable_profiler: true
trace_log_interval_count: 200
trace_log_path: "/sdcard/Download/"
}
Currently, the profiler config can only be specified in the CalculatorGraphConfig for the graph we wish to trace. The field is CalculatorGraphConfig.profiler_config. Let me know if this field is sufficient for you to start profiling and/or tracing.
The same device can run mlkit's sample with no issue https://github.com/googlesamples/mlkit
however, when running mediapipe's objectdectioncpu example, I can't get a camera preview or any results.
objectdectiongpu can open the camera with a longer delay than mlkit. where should I start to debug the problem? Thanks
Here is the log I run objectdectioncpu
and logs for objectdectiongpu