googlesamples / googlesamples/mlkit
[Bug report] Non-Accurate Pose Detection Crashes In Non-CPU Mode
- Dominant language
- Kotlin
- Stars
- 4.3k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
A custom app using the MLKit library crashes on the first call of `Detector#process(android.media.Image, int)`.
Logcat excerpt:
```
2022-04-07 18:55:06.227 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.261 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.294 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.327 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.361 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.394 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.427 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.461 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.494 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.527 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.528 1434-6440/? E/Camera3-OutputUtils: requestStreamBuffers: request too much buffers for stream 0: at HAL: 8 + requesting: 1 > max: 8
2022-04-07 18:55:06.528 1225-16641/? W/CHIUSECASE: RequestStreamBufferFromFwk: request failed due to error: 4
2022-04-07 18:55:06.528 1225-16641/? W/CHIUSECASE: RequestStreamBufferFromFwk: buffer_ret[0] error: 2
2022-04-07 18:55:06.528 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a104346a8 marked as abandoned.
2022-04-07 18:55:06.560 1225-2027/? I/CHIUSECASE: RequestStreamBuffers: dummy buffer returned for stream 0x7a104346a8
2022-04-07 18:55:06.560 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.560 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a104346a8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.576 1452-1452/? I/EaselThermalMonitor: Cooling Device: mnh cur_state 0 max_state 4
2022-04-07 18:55:06.594 1225-2029/? I/CHIUSECASE: RequestStreamBuffers: dummy buffer returned for stream 0x7a104346a8
2022-04-07 18:55:06.594 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a1033e1e8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.594 1225-16641/? I/CHIUSECASE: Refill: StreamBufferCache for stream 0x7a104346a8 has been abandoned. Can not refill cache any more.
2022-04-07 18:55:06.616 1434-16606/? E/Camera3-OutputUtils: Camera 0: notifyError: cannot find in-flight request on frame 435 error
2022-04-07 18:55:06.617 16534-16550/eu.ezytarget.exercisedetection E/CameraDevice-JV-0: Receive capture error on unknown request ID -1
2022-04-07 18:55:06.618 1434-16606/? E/Camera3-OutputUtils: Camera 0: notifyError: cannot find in-flight request on frame 437 error
2022-04-07 18:55:06.618 16534-16550/eu.ezytarget.exercisedetection E/CameraDevice-JV-0: Receive capture error on unknown request ID -1
2022-04-07 18:55:06.619 1434-16606/? E/Camera3-OutputUtils: Camera 0: notifyError: cannot find in-flight request on frame 439 error
2022-04-07 18:55:06.620 16534-16550/eu.ezytarget.exercisedetection E/CameraDevice-JV-0: Receive capture error on unknown request ID -1
2022-04-07 18:55:06.621 1434-16606/? E/Camera3-OutputUtils: Camera 0: notifyError: cannot find in-flight request on frame 441 error
2022-04-07 18:55:06.622 16534-16550/eu.ezytarget.exercisedetection E/CameraDevice-JV-0: Receive capture error on unknown request ID -1
2022-04-07 18:55:06.623 1434-16606/? E/Camera3-OutputUtils: Camera 0: notifyError: cannot find in-flight request on frame 443 error
2022-04-07 18:55:06.623 16534-16550/eu.ezytarget.exercisedetection E/CameraDevice-JV-0: Receive capture error on unknown request ID -1
2022-04-07 18:55:06.625 1434-16606/? E/Camera3-OutputUtils: Camera 0: notifyError: cannot find in-flight request on frame 445 error
2022-04-07 18:55:06.625 16534-16550/eu.ezytarget.exercisedetection E/CameraDevice-JV-0: Receive capture error on unknown request ID -1
2022-04-07 18:55:06.626 1434-16606/? E/Camera3-OutputUtils: Camera 0: notifyError: cannot find in-flight request on frame 447 error
```
**To Reproduce**
Example Steps to reproduce the behavior in sample app:
1. Create an Android app using the library `com.google.mlkit:pose-detection:18.0.0-beta2`.
2. Build the app with `compileSdk=32`, `buildToolsVersion="32.0.0"`, `targetSdk=32`.
3. Initialize a `PoseDetector` like so:
```
PoseDetection.getClient(
PoseDetectorOptions.Builder()
.setDetectorMode(PoseDetectorOptions.STREAM_MODE)
.build()
)
```
4. Use the `PoseDetector` to process a media image obtained from a camera2 `ImageReader`.
5. Run the app on a Pixel 3 XL running Android 12.
6. Observe that the app crashes and outputs a seemingly infinite amount of `cannot find in-flight request on frame` error messages.
**Expected behavior**
The app does not crash.
Note: The app **works as expected** when either:
a. `PoseDetectorOptions.Builder` is called with `setPreferredHardwareConfigs(CPU)`.
b. `AccuratePoseDetectorOptions.Builder` is used instead and the pose detection is run in accurate mode. This does not require setting the preferred hardware config.
**SDK Info:**
- `com.google.mlkit:pose-detection:18.0.0-beta2`
**Smartphone:**
- Device: Pixel 3 XL
- Device OS: Android 12
**Development Environment:**
- IDE Version: Android Studio Bumblebee 2021.1.1 Path 3
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.