-
Notifications
You must be signed in to change notification settings - Fork 8
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
mp_start crash #3
Comments
my env is android rk3588.my mediapipe version is 0.8.11 |
2023-10-25 16:49:22.071 3460-3524/com.mholos.gesture A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 3524 (mediapipe/3524), pid 3460 (.mholos.gesture) |
i see that you use the same build file on linux ,windows and android ,but should the android build file be a little different? i see in google-ai-edge/mediapipe#3361 that the graph is different in mobile android devices from pcs |
Hi @westpilgrim63, thanks for the detailed report! It looks like MediaPipe can't find some graph file when starting up. You probably need to copy the data directory to your Android assets and call I'm not sure if the build file is the problem here, we managed to get our app running on Android using this one. |
@
@chnoblouch do you have some code example used in android jni? i copy the initialization code from example to my jni so lib, but i guess maybe the init code in pc and in jni is a little different? |
Unfortunately, I haven't created a standalone Android example yet, but we did something like this in our app: public class ExampleActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initMediaPipe(this, getCacheDir().getAbsolutePath());
}
private static native void initMediaPipe(Context androidContext, String cacheDirPath);
} extern "C" JNIEXPORT void JNICALL
Java_com_example_ExampleActivity_initMediaPipe(JNIEnv* env, jclass obj, jobject assetManager, jstring cacheDirPath) {
mp_init_asset_manager(env, assetManager, cacheDirPath);
const char *path = "<path to mediapipe data>/modules/hand_landmark/hand_landmark_tracking_cpu.binarypb";
mp_instance_builder *builder = mp_create_instance_builder(path, "image");
mp_add_option_float(builder, "palmdetectioncpu__TensorsToDetectionsCalculator", "min_score_thresh", 0.6);
mp_add_option_double(builder, "handlandmarkcpu__ThresholdingCalculator", "threshold", 0.2);
mp_add_side_packet(builder, "num_hands", mp_create_packet_int(2));
mp_add_side_packet(builder, "model_complexity", mp_create_packet_int(1));
mp_add_side_packet(builder, "use_prev_landmarks", mp_create_packet_bool(true));
mp_instance *instance = mp_create_instance(builder);
mp_poller *landmarks_poller = mp_create_poller(instance, "multi_hand_landmarks");
// Do something with the graph
} The initialization code is very similar to the desktop example, there is just a new call to The problem on Android is loading the files. The graph ( We could probably simplify this by adding a function to load graphs from the assets. |
your timly reply help me a lot.thanks very much.i will try it tomorrow |
@chnoblouch hi , i run init with success. but when the program reach mp_process ,the app crashed again.
the error log is : 2023-10-27 10:39:31.292 5257-5476/com.mholos.gesture E/libc++abi: terminating with uncaught exception of type cv::Exception: OpenCV(4.8.0) /home/ci/opencv/modules/core/src/alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 409668290592 bytes in function 'OutOfMemoryError'
2023-10-27 10:39:31.292 5257-5476/com.mholos.gesture A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5476 (mediapipe_gl_ru), pid 5257 (.mholos.gesture) 2023-10-27 10:39:34.734 5503-5503/? E/audit: rate limit exceeded 2023-10-27 10:39:31.670 5503-5503/? E/libprotobuf-native: [libprotobuf ERROR external/protobuf/src/google/protobuf/wire_format_lite.cc:584] String field 'LogMessage.message' contains invalid UTF-8 data when serializing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes. 2023-10-27 10:39:31.670 5503-5503/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 2023-10-27 10:39:31.670 5503-5503/? A/DEBUG: Build fingerprint: 'Firefly/rk3588/rk3588:12/SP2A.220405.004/star10131103:userdebug/release-keys' 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: Revision: '0' 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: ABI: 'arm64' 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: Timestamp: 2023-10-27 02:39:31.418693309+0000 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: Process uptime: 1s 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: Cmdline: com.mholos.gesture 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: pid: 5257, tid: 5476, name: mediapipe_gl_ru >>> com.mholos.gesture <<< 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: uid: 10106 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: tagged_addr_ctrl: 0000000000000001 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr -------- 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: Abort message: 'terminating with uncaught exception of type cv::Exception: OpenCV(4.8.0) /home/ci/opencv/modules/core/src/alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 409668290592 bytes in function 'OutOfMemoryError'
2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: x0 0000000000000000 x1 0000000000001564 x2 0000000000000006 x3 0000007943447780 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: x4 736f646277641f73 x5 736f646277641f73 x6 736f646277641f73 x7 7f7f7f7f7f7f7f7f 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: x8 00000000000000f0 x9 9e580233dab32ca7 x10 0000000000000000 x11 ffffff80fffffbdf 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: x12 0000000000000001 x13 000000007fffffff x14 00000000000fb768 x15 000000099c5975d9 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: x16 0000007c08b16050 x17 0000007c08af2db0 x18 0000000000000004 x19 0000000000001489 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: x20 0000000000001564 x21 00000000ffffffff x22 ffffff80ffffffc8 x23 00000079434479d0 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: x24 00000079434478b0 x25 00000079434478f0 x26 0000007943449000 x27 0000000000000000 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: x28 0000007943448568 x29 0000007943447800 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: lr 0000007c08aa5aa0 sp 0000007943447760 pc 0000007c08aa5acc pst 0000000000001000 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: backtrace: 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #00 pc 000000000004facc /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: cd7952cb40d1a2deca6420c2da7910be) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #1 pc 0000000000e8d23c /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #2 pc 0000000000e8d394 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #3 pc 0000000000e8a298 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #4 pc 0000000000e89ba0 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so (__cxa_rethrow+196) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #5 pc 00000000000913ac /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libobsensor_jni.so (cv::Mat::create(int, int const*, int)+1356) (BuildId: 85f155b418641893c482b7519cf36996311dfb60) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #6 pc 00000000000920e0 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libobsensor_jni.so (cv::Mat::create(cv::Size_, int)+108) (BuildId: 85f155b418641893c482b7519cf36996311dfb60) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #7 pc 00000000000c3754 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libobsensor_jni.so (cv::OutputArray::create(cv::Size, int, int, bool, cv::_OutputArray::DepthMask) const+136) (BuildId: 85f155b418641893c482b7519cf36996311dfb60) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #8 pc 000000000056d22c /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libopencv_java4.so (cv::warpPerspective(cv::_InputArray const&, cv::OutputArray const&, cv::InputArray const&, cv::Size, int, int, cv::Scalar const&)+528) (BuildId: a4de418c8c6a4390de7780366c357d03726e92f8) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #9 pc 0000000000610094 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #10 pc 000000000060a1e0 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so (mediapipe::api2::ImageToTensorCalculator::Process(mediapipe::CalculatorContext*)+2616) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #11 pc 0000000000bb0470 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so (mediapipe::CalculatorNode::ProcessNode(mediapipe::CalculatorContext*)+1004) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #12 pc 0000000000b8c6a8 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so (mediapipe::internal::SchedulerQueue::RunCalculatorNode(mediapipe::CalculatorNode*, mediapipe::CalculatorContext*)+304) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #13 pc 0000000000b8c14c /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so (mediapipe::internal::SchedulerQueue::RunNextTask()+232) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #14 pc 0000000000ba33b4 /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #15 pc 0000000000b9dd3c /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so (mediapipe::GlContext::DedicatedThread::ThreadBody()+160) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #16 pc 0000000000b9d76c /data/app/~~k6mnjF_JSdnexiLArM0muQ==/com.mholos.gesture-dd05Su4kGmPwIfZqRHY1gA==/base.apk!libmediapipe.so (mediapipe::GlContext::DedicatedThread::ThreadBody(void*)+8) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #17 pc 00000000000b1810 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264) (BuildId: cd7952cb40d1a2deca6420c2da7910be) 2023-10-27 10:39:31.671 5503-5503/? A/DEBUG: #18 pc 00000000000512f0 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: cd7952cb40d1a2deca6420c2da7910be) could you please help me one last time?i am deeply grateful!!!!! |
solved. the reason is i compile mediapipe with opencv 4.5.0. but i use opencv 4.8.0 in my jni code. i replace 4.5.0 with 4.8.0 .and recompile mp .now i can run mp on android rk3588 successfully. |
hi,i compiled a so lib on android using the build-aarch64-android.sh script you provided.
i use this so lib in my jni cpp sdk,but the app crashed on initialization.
if i commented out the mp_start sentence, the initialization runs successful .
how can i solve this problem?
The text was updated successfully, but these errors were encountered: