Skip to content
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

App Crash with YOLO11n TFLite Model on Android. Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) on GPU mode #555

Open
pkgoogle opened this issue Jan 22, 2025 · 4 comments
Assignees
Labels
status:awaiting user response awaiting user response status:need more data need more data

Comments

@pkgoogle
Copy link

Original Issue: App Crash with YOLO11n TFLite Model on Android. Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) on GPU mode
Original Author: @emoo44566

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

No

Source

source

TensorFlow version

tf 2.16.1

Custom code

Yes

OS platform and distribution

Android

Mobile device

Some Android Devices

Python version

No response

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

I converted the YOLO11n model to TensorFlow Lite (TFLite) and used it in my Android app. However, my app crashes on some Android devices, and the following error appears in Logcat:
Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)

To create the TFLite model, I tried various conversion options in YOLO, as shown below:

# Load a model
model = YOLO("yolo11n.pt")  # load an official model
# model = YOLO("path/to/best.pt")  # load a custom trained model

# Export the model
# model.export(format="tflite", half = True, batch = 4)

model.export(format="tflite", half = True, int8 = True)

Despite testing different configurations, the app consistently crashes when using the model in GPU mode.

Interestingly, this issue only occurs with the YOLO11n TFLite model. When I use other TFLite models, such as YOLOv8n or YOLOv9t, everything works fine. This suggests there may be a compatibility issue or a bug in the TFLite Android library specific to the YOLO11n model.

Standalone code to reproduce the issue

I'm testing my YOLO TFLite model with the code in this repository:
https://github.com/surendramaran/YOLO/tree/main/YOLOv9-Object-Detector-Android-Tflite

Relevant log output

No response

@pkgoogle pkgoogle self-assigned this Jan 22, 2025
@pkgoogle
Copy link
Author

Hi @emoo44566, Your Yolov11 project is empty -- are you testing it in one of the other projects?

@pkgoogle pkgoogle added status:need more data need more data status:awaiting user response awaiting user response labels Jan 24, 2025
@emoo44566
Copy link

Hi @emoo44566, Your Yolov11 project is empty -- are you testing it in one of the other projects?

Hi
The project can be found here:
YOLOv9-Object-Detector-Android-Tflite

The code for YOLOv11 should work similarly—just replace or add the YOLOv11 model to this project. Let me know if you need any help with the process!

@pkgoogle
Copy link
Author

Hi @emoo44566,

I'm yielding these results with the yolo11n_float16.tflite model:

2025-01-27 13:52:33.894  7032-7179  emuglGLESv2_enc         com.surendramaran.yolov9tflite       E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glTexStorage2D:4319 GL error 0x502 condition [!state->getBoundTexture(target)]
2025-01-27 13:52:33.894  7032-7179  emuglGLESv2_enc         com.surendramaran.yolov9tflite       E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glFramebufferTexture2D:3219 GL error 0x502 condition [!state->getBoundFramebuffer(target)]
2025-01-27 13:52:33.894  7032-7179  emuglGLESv2_enc         com.surendramaran.yolov9tflite       E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glDrawBuffers:4236 GL error 0x502 condition [!ctx->m_state->boundFramebuffer(GL_DRAW_FRAMEBUFFER) && glUtilsColorAttachmentIndex(bufs[i]) != -1]
2025-01-27 13:52:33.910  7032-7179  tflite                  com.surendramaran.yolov9tflite       I  Replacing 792 out of 802 node(s) with delegate (TfLiteXNNPackDelegate) node, yielding 9 partitions for the whole graph.

It actually doesn't crash for me as it seems to fallback to the XNNPack Delegate

I am using a Pixel 8 Pro API 34-ext12 ARM emulator... which phone(s) are you using?

@emoo44566
Copy link

The crash only happens on certain phones, such as some Xiaomi devices.
Xiaomi Redmi note 12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:awaiting user response awaiting user response status:need more data need more data
Projects
None yet
Development

No branches or pull requests

2 participants