mediapipe
mediapipe copied to clipboard
Image Generator task: App crashes when clicked on Initialize button
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
No
OS Platform and Distribution
Android 10
MediaPipe Tasks SDK version
No response
Task name (e.g. Image classification, Gesture recognition etc.)
Image Generator
Programming Language and version (e.g. C++, Python, Java)
Kotlin
Describe the actual behavior
When clicking on the Initialize button for any of the options (Standalone Generation, Generation with Plugins, Generation with LoRA Weights), the app crashes and restarts.
Describe the expected behaviour
After clicking on the Initialize button, I should ideally get the screen to enter a text prompt and generate images.
Standalone code/steps you may have used to try to get what you need
1. Cloned the image generator example and built it in Android Studio.
2. Copied the foundation model to /data/local/tmp/image_generator/bins folder in my Android device.
3. Installed the APK on my phone.
4. Opened the application (it started successfully), then clicked on Standalone Generation option, clicked on Initialize button.
5. App crashes.
I'm using Samsung Galaxy M30 to test.
Other info / Complete Logs
channel 'ccb6f1a com.google.mediapipe.examples.imagegeneration/com.google.mediapipe.examples.imagegeneration.diffusion.DiffusionActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2024-01-14 00:07:26.751 4210-4434 InputDispatcher system_server E channel '2061262 com.google.mediapipe.examples.imagegeneration/com.google.mediapipe.examples.imagegeneration.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2024-01-14 00:07:27.025 4210-4270 WindowManager system_server E RemoteException occurs on reporting focusChanged, w=Window{ccb6f1a u0 com.google.mediapipe.examples.imagegeneration/com.google.mediapipe.examples.imagegeneration.diffusion.DiffusionActivity}
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(BinderProxy.java:527)
at android.view.IWindow$Stub$Proxy.windowFocusChanged(IWindow.java:797)
at com.android.server.wm.WindowState.reportFocusChangedSerialized(WindowState.java:3597)
at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:5202)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.os.HandlerThread.run(HandlerThread.java:67)
at com.android.server.ServiceThread.run(ServiceThread.java:44)
Update: I tried to run the app on a different mobile phone (OnePlus Nord CE3 Lite) - Android 13 and now I get a different error.
E0000 00:00:1705733677.683472 7245 diffuser_gpu.cc:88] UNKNOWN: Failed to create 2D texture (clCreateImage): Invalid image size 2024-01-20 12:24:37.698 2334-7240 native com...pipe.examples.imagegeneration E E0000 00:00:1705733677.693824 7240 calculator_graph.cc:875] INTERNAL: CalculatorGraph::Run() failed: Calculator::Open() for node "mediapipe_tasks_vision_image_generator_imagegeneratorgraph__StableDiffusionIterateCalculator" failed: ; RET_CHECK failure (mediapipe/tasks/cc/vision/image_generator/diffuser/stable_diffusion_iterate_calculator.cc:237) context_ 2024-01-20 12:24:37.740 2334-7240 AndroidRuntime com...pipe.examples.imagegeneration E FATAL EXCEPTION: DefaultDispatcher-worker-1 Process: com.google.mediapipe.examples.imagegeneration, PID: 2334 com.google.mediapipe.framework.MediaPipeException: internal: CalculatorGraph::Run() failed: Calculator::Open() for node "mediapipe_tasks_vision_image_generator_imagegeneratorgraph__StableDiffusionIterateCalculator" failed: ; RET_CHECK failure (mediapipe/tasks/cc/vision/image_generator/diffuser/stable_diffusion_iterate_calculator.cc:237) context_ at com.google.mediapipe.framework.Graph.nativeWaitUntilGraphIdle(Native Method) at com.google.mediapipe.framework.Graph.waitUntilGraphIdle(Graph.java:464) at com.google.mediapipe.tasks.core.TaskRunner.create(TaskRunner.java:74) at com.google.mediapipe.tasks.vision.imagegenerator.ImageGenerator.createFromOptions(ImageGenerator.java:167) at com.google.mediapipe.tasks.vision.imagegenerator.ImageGenerator.createFromOptions(ImageGenerator.java:96) at com.google.mediapipe.examples.imagegeneration.ImageGenerationHelper.initializeImageGenerator(ImageGenerationHelper.kt:32) at com.google.mediapipe.examples.imagegeneration.diffusion.DiffusionViewModel$initializeImageGenerator$3.invokeSuspend(DiffusionViewModel.kt:66) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@f2b8197, Dispatchers.Default] 2024-01-20 12:24:37.804 2334-7240 Process com...pipe.examples.imagegeneration I Sending signal. PID: 2334 SIG: 9 ---------------------------- PROCESS ENDED (2334) for package com.google.mediapipe.examples.imagegeneration ---------------------------- ---------------------------- PROCESS STARTED (5185) for package com.google.mediapipe.examples.imagegeneration ---------------------------- 2024-01-20 12:24:38.500 5185-5185 ConfigurationController com...pipe.examples.imagegeneration I handleConfigurationChanged: true, config: {1.0 ??mcc??mnc [en_GB] ldltr sw360dp w360dp h720dp 480dpi nrml long hdr widecg port night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2400) mAppBounds=Rect(0, 107 - 1080, 2268) mMaxBounds=Rect(0, 0 - 1080, 2400) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} s.427 fontWeightAdjustment=0mThemeChanged= 0, mThemeChangedFlags= 0, mFlipFont= 0, mAccessibleChanged= -1, mUxIconConfig= 3468921665126662177, mMaterialColor= 0, mUserId= 0, mFontUserId= 0, mFontVariationSettings= 226, mFoldingAngle = -1.0, mIconPackName= , mDarkModeBackgroundMaxL= 0.0, mDarkModeDialogBgMaxL= 27.0, mDarkModeForegroundMinL= 100.0, mOplusConfigType= 1, mOplusChangedConfigs= 0, OpSans= 0, mBurmeseFontFlag= 2, mFlag= 0, mPuttDisplayFlag= -1} , curconfig: {1.0 ??mcc??mnc [en_GB] ldltr sw360dp w360dp h720dp 480dpi nrml long hdr widecg port night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2400) mAppBounds=Rect(0, 107 - 1080, 2268) mMaxBounds=Rect(0, 0 - 1080, 2400) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} s.427 fontWeightAdjustment=0mThemeChanged= 0, mThemeChangedFlags= 0, mFlipFont= 0, mAccessibleChanged= -1, mUxIconConfig= 3468921665126662177, mMaterialColor= 0, mUserId= 0, mFontUserId= 0, mFontVariationSettings= 226, mFoldingAngle = -1.0, mIconPackName= , mDarkModeBackgroundMaxL= 0.0, mDarkModeDialogBgMaxL= 27.0, mDarkModeForegroundMinL= 100.0, mOplusConfigType= 1, mOplusChangedConfigs= 0, OpSans= 0, mBurmeseFontFlag= 2, mFlag= 0, mPuttDisplayFlag= -1} android.app.ActivityThread.handleLaunchActivity:4003 android.app.servertransaction.LaunchActivityItem.execute:111 android.app.servertransaction.TransactionExecutor.executeCallbacks:135 android.app.servertransaction.TransactionExecutor.execute:95 android.app.ActivityThread$H.handleMessage:2474 android.os.Handler.dispatchMessage:106 android.os.Looper.loopOnce:240 android.os.Looper.loop:351 android.app.ActivityThread.main:8422 java.lang.reflect.Method.invoke:-2 2024-01-20 12:24:38.538 5185-5185 AppCompatDelegate com...pipe.examples.imagegeneration D Checking for metadata for AppLocalesMetadataHolderService : Service not found 2024-01-20 12:24:38.543 5185-7682 imagegeneration com...pipe.examples.imagegeneration E Loaded layer handle (8523344943723458859) for layer /my_product/lib64/libcolorx-loader.so 2024-01-20 12:24:38.543 5185-7682 imagegeneration com...pipe.examples.imagegeneration E Looking for entrypoint ColorX_Check 2024-01-20 12:24:38.543 5185-7682 imagegeneration com...pipe.examples.imagegeneration E Found ColorX_Check for /my_product/lib64/libcolorx-loader.so 2024-01-20 12:24:38.543 5185-7682 imagegeneration com...pipe.examples.imagegeneration E Check failed 2024-01-20 12:24:38.568 5185-5185 oplus.andr...actoryImpl com...pipe.examples.imagegeneration I Unknow feature:IOplusTextViewRTLUtilForUG 2024-01-20 12:24:38.596 5185-5185 OplusCusto...ionManager com...pipe.examples.imagegeneration E sInstance is null, start a new sInstance
@NSTiwari on your steps above you have not mentioned converting the standalone model with the convert.py script. Have you done this step?
@NSTiwari on your steps above you have not mentioned converting the standalone model with the convert.py script. Have you done this step?
@farmaker47 Yes, this step was done. Here you can find the link to the converted standalone model.
@khanhlvg: Could you please help with this issue?
Hi @khanhlvg, @joezoug,
I attempted to replicate the issue on a Pixel 6a running Android 13, diligently adhering to the provided instructions. Regrettably, despite completing all the prescribed steps, I encountered difficulties in utilizing Standalone Generation, Generation with Plugins, and Generation with LoRA Weights. The applications restart upon selecting these options.
Could you check out this issue, please? Thank you!!
Hi @gustheman,
Could you please have a look into this issue? Thank you!