ncnn-android-nanodet
ncnn-android-nanodet copied to clipboard
Black screen after opening App
After i opening the App, it does not crash, just keep black screen. My hareware device is Hikey 970
whose android version is 9, it uses USB to connect to a camera. The Run log is :
03/19 13:51:10: Launching 'app' on unknown AOSP on hikey970.
App restart successful without requiring a re-install.
$ adb shell am start -n "com.example.nanodetncnn/com.example.nanodetncnn.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 18720 on device 'unknown-aosp_on_hikey970-5D9F139D0282DD8C'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/ple.nanodetncn: The ClassLoaderContext is a special shared library.
D/ncnn: JNI_OnLoad
I/nanodetncnn: MainActivity: onCreate com.example.nanodetncnn.MainActivity@f767d32
D/OpenGLRenderer: Skia GL Pipeline
I/nanodetncnn: MainActivity: cameraView getHolder()
I/ple.nanodetncnn: type=1400 audit(0.0:6809): avc: denied { read } for name="stat" dev="proc" ino=294665 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:r:init:s0 tclass=file permissive=1
D/ncnn: loadModel 0xe25db8a5bdc0
I/ple.nanodetncnn: type=1400 audit(0.0:6810): avc: denied { open } for path="/proc/1/task/1/stat" dev="proc" ino=294665 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:r:init:s0 tclass=file permissive=1
type=1400 audit(0.0:6811): avc: denied { search } for name="2" dev="proc" ino=11574 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=1
D/ncnn: openCamera 0
W/NdkCamera: open
W/NdkCamera: open 0
E/ACameraManager: Get camera characteristics from camera service failed: Status(-8): '10: getCameraCharacteristics:491: Unable to retrieve camera characteristics for device : No such file or directory (-2)'
openCamera: cannot get camera characteristics for camera . err -10000
E/NdkCameraDevice: ACameraDevice_createCaptureRequest: invalid argument! device 0x0 request 0xe25dc27b46f8
E/NdkCaptureRequest: ACaptureRequest_addTarget: Error: invalid input: req 0x0, req-targets 0x0, target 0xe25dc262b9e8
E/NdkCameraDevice: ACameraDevice_createCaptureSession: Error: invalid input: device 0x0, outputs 0xe25dc2732e80, callbacks 0xffffc06fa488, session 0xe25dc27b4710
E/NdkCameraCaptureSession: ACameraCaptureSession_setRepeatingRequest: Error: invalid input: session 0x0, numRequest 1, requests 0xe25dc27b46f8
I/nanodetncnn: MainActivity: onResume打开摄像头
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 2
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
I/nanodetncnn: MainActivity: 执行了surfaceChanged
D/ncnn: setOutputWindow 0xe25da3abb010
I/nanodetncnn: MainActivity: 执行了surfaceChanged
D/vndksupport: Loading /vendor/lib64/hw/[email protected] from current namespace instead of sphal namespace.
Loading /vendor/lib64/hw/gralloc.hikey970.so from current namespace instead of sphal namespace.
D/vndksupport: Loading /vendor/lib64/hw/gralloc.hikey970.so from current namespace instead of sphal namespace.
D/vndksupport: Loading /vendor/lib64/hw/gralloc.hikey970.so from current namespace instead of sphal namespace.
Above log begin wirh "I/nanodetncnn:" are my additional log.
E/ACameraManager: Get camera characteristics from camera service failed: Status(-8): '10: getCameraCharacteristics:491: Unable to retrieve camera characteristics for device : No such file or directory (-2)'
openCamera: cannot get camera characteristics for camera . err -10000
error message indicates that the camera may not be supported via ndk camera api
This device hikey970 with usb camera also have problem with CameraX used by original nanodet ncnn android app, it will crash when it try to open camera with error : java.lang.RuntimeException: Unable to get provider androidx.camera.camera2.impl.Camera2Initializer: java.lang.NumberFormatException: For input string: "/dev/video0"
, then i searched it on the internet, find this answer on stackoverflow, i try to run adb shell dumpsys media.camera
on hikey970, its output log is :
== Service global info: ==
Number of camera devices: 1
Number of normal camera devices: 1
Device 0 maps to "/dev/video0"
Active Camera Clients:
[]
Allowed user IDs: 0
== Camera service events log (most recent at top): ==
12-11 07:11:45 : DISCONNECT device /dev/video0 client for package org.tensorflow.lite.examples.detection (PID 0)
12-11 07:11:45 : DIED client(s) with PID 2582, reason: (Binder died unexpectedly)
12-11 07:11:35 : CONNECT device /dev/video0 client for package org.tensorflow.lite.examples.detection (PID 6183)
12-11 07:11:35 : DISCONNECT device /dev/video0 client for package com.sample.textureview (PID 6094)
12-11 07:11:35 : EVICT device /dev/video0 client held by package com.sample.textureview (PID 6094, score 200, state 2)
- Evicted by device /dev/video0 client for package org.tensorflow.lite.examples.detection (PID 6183, score 0, state 2)
12-11 07:11:08 : CONNECT device /dev/video0 client for package com.sample.textureview (PID 6094)
12-11 07:11:07 : DISCONNECT device /dev/video0 client for package com.example.iguardonmzlt2 (PID 5635)
12-11 07:10:30 : CONNECT device /dev/video0 client for package com.example.iguardonmzlt2 (PID 5635)
12-11 07:07:35 : ADD device /dev/video0, reason: (Device added)
12-11 07:05:00 : REMOVE device /dev/video0, reason: (Device status changed from 1 to 0)
12-11 07:02:42 : USER_SWITCH previous allowed user IDs: <None>, current allowed user IDs: 0
01-01 00:14:55 : ADD device /dev/video0, reason: (Device added)
01-01 00:14:55 : ADD device /dev/video0, reason: (Device status changed from 0 to 1)
== Camera device /dev/video0 dynamic info: ==
Device /dev/video0 is closed, no client instance
== Camera Provider HAL external/0 (v2.4, remote) static info: 1 devices: ==
== Camera HAL device [email protected]/external//dev/video0 (v3.4) static information: ==
Resource cost: 100
Conflicting devices: None
API1 info:
Has a flash unit: false
Facing: Front
Orientation: 0
API2 camera characteristics:
Dumping camera metadata array: 52 / 52 entries, 1256 / 1256 bytes of extra data.
Version: 1, Flags: 00000000
android.info.supportedHardwareLevel (150000): byte[1]
[EXTERNAL ]
android.colorCorrection.availableAberrationModes (00004): byte[1]
[0 ]
android.control.aeAvailableAntibandingModes (10012): byte[1]
[3 ]
android.control.maxRegions (1001c): int32[3]
[0 0 0 ]
android.control.availableVideoStabilizationModes (1001a): byte[1]
[0 ]
android.control.awbAvailableModes (1001b): byte[1]
[1 ]
android.control.aeAvailableModes (10013): byte[1]
[1 ]
android.control.availableEffects (10018): byte[1]
[0 ]
android.control.availableModes (10026): byte[2]
[0 1 ]
android.edge.availableEdgeModes (30002): byte[1]
[0 ]
android.flash.info.available (50000): byte[1]
[FALSE ]
android.hotPixel.availableHotPixelModes (60001): byte[1]
[0 ]
android.jpeg.availableThumbnailSizes (70007): int32[4]
[0 0 240 180 ]
android.jpeg.maxSize (70008): int32[1]
[5242880 ]
android.lens.info.focusDistanceCalibration (90007): byte[1]
[UNCALIBRATED ]
android.lens.info.availableOpticalStabilization (90003): byte[1]
[0 ]
android.lens.facing (80005): byte[1]
[EXTERNAL ]
android.noiseReduction.availableNoiseReductionModes (a0002): byte[1]
[0 ]
android.noiseReduction.mode (a0000): byte[1]
[OFF ]
android.request.availableCapabilities (c000c): byte[1]
[BACKWARD_COMPATIBLE ]
android.request.partialResultCount (c000b): int32[1]
[1 ]
android.request.pipelineMaxDepth (c000a): byte[1]
[4 ]
android.request.maxNumOutputStreams (c0006): int32[3]
[0 2 1 ]
android.request.maxNumInputStreams (c0008): int32[1]
[0 ]
android.scaler.availableMaxDigitalZoom (d0004): float[1]
[1.00000000 ]
android.scaler.croppingType (d000d): byte[1]
[CENTER_ONLY ]
android.sensor.availableTestPatternModes (e0019): int32[1]
[0 ]
android.sensor.info.timestampSource (f0008): byte[1]
[UNKNOWN ]
android.sensor.orientation (e000e): int32[1]
[0 ]
android.shading.availableModes (100002): byte[1]
[0 ]
android.statistics.info.availableFaceDetectModes (120000): byte[1]
[0 ]
android.statistics.info.maxFaceCount (120002): int32[1]
[0 ]
android.statistics.info.availableHotPixelMapModes (120006): byte[1]
[0 ]
android.statistics.info.availableLensShadingMapModes (120007): byte[1]
[0 ]
android.sync.maxLatency (170001): int32[1]
[UNKNOWN ]
android.request.availableRequestKeys (c000d): int32[27]
[3 65536 65537 65538 ]
[65539 65542 65541 65543 ]
[65545 65546 65547 65549 ]
[65550 65551 65552 65553 ]
[262146 458755 458756 458757 ]
[458758 524292 655360 851968 ]
[917528 1114112 1114115 ]
android.request.availableResultKeys (c000e): int32[34]
[3 65536 65537 65538 ]
[65539 65542 65567 65541 ]
[65543 65568 65545 65546 ]
[65547 65570 65549 65550 ]
[65551 65552 65553 262146 ]
[262149 458755 458756 458757 ]
[458758 524292 655360 786441 ]
[851968 917520 1114112 1114115 ]
[1114128 1114126 ]
android.request.availableCharacteristicsKeys (c000f): int32[42]
[4 65554 65555 65556 ]
[65557 65558 65572 65559 ]
[65560 65574 65561 65562 ]
[65563 65573 65564 327680 ]
[1376256 458759 524293 589827 ]
[589831 655362 786444 786440 ]
[786438 786443 786442 851972 ]
[851978 851981 983040 983044 ]
[983046 983050 983048 917518 ]
[1048578 1179648 1179654 1179655 ]
[1179650 1507329 ]
android.control.aeCompensationRange (10015): int32[2]
[0 0 ]
android.control.aeCompensationStep (10016): rational[1]
[(0 / 1) ]
android.control.afAvailableModes (10017): byte[2]
[1 0 ]
android.control.availableSceneModes (10019): byte[1]
[0 ]
android.control.aeLockAvailable (10024): byte[1]
[FALSE ]
android.control.awbLockAvailable (10025): byte[1]
[FALSE ]
android.control.aeAvailableTargetFpsRanges (10014): int32[2]
[15 30 ]
android.scaler.availableStreamConfigurations (d000a): int32[36]
[33 320 240 OUTPUT ]
[35 320 240 OUTPUT ]
[34 320 240 OUTPUT ]
[33 352 288 OUTPUT ]
[35 352 288 OUTPUT ]
[34 352 288 OUTPUT ]
[33 640 480 OUTPUT ]
[35 640 480 OUTPUT ]
[34 640 480 OUTPUT ]
android.scaler.availableMinFrameDurations (d000b): int64[36]
[33 320 ]
[240 33333333 ]
[35 320 ]
[240 33333333 ]
[34 320 ]
[240 33333333 ]
[33 352 ]
[288 33333333 ]
[35 352 ]
[288 33333333 ]
[34 352 ]
[288 33333333 ]
[33 640 ]
[480 33333333 ]
[35 640 ]
[480 33333333 ]
[34 640 ]
[480 33333333 ]
android.scaler.availableStallDurations (d000c): int64[36]
[33 320 ]
[240 1000000000 ]
[35 320 ]
[240 0 ]
[34 320 ]
[240 0 ]
[33 352 ]
[288 1000000000 ]
[35 352 ]
[288 0 ]
[34 352 ]
[288 0 ]
[33 640 ]
[480 1000000000 ]
[35 640 ]
[480 0 ]
[34 640 ]
[480 0 ]
android.sensor.info.maxFrameDuration (f0004): int64[1]
[66666666 ]
android.sensor.info.preCorrectionActiveArraySize (f000a): int32[4]
[0 0 640 480 ]
android.sensor.info.activeArraySize (f0000): int32[4]
[0 0 640 480 ]
android.sensor.info.pixelArraySize (f0006): int32[2]
[640 480 ]
== Camera HAL device [email protected]/external//dev/video0 (v3.4) dumpState: ==
No active camera device session instance
== Vendor tags: ==
Dumping vendor tag descriptors for vendor with id 2592128789
Dumping configured vendor tag descriptors: None set
== Camera error traces (0): ==
No camera traces collected.
Can you find some useful clues from these infomation ?
sorry, I have no idea of using external camera. You may refer https://groups.google.com/g/android-platform/c/Qx1P0I17uzs https://source.android.com/devices/camera/external-usb-cameras
I met the same problem, here is the log:
03/28 21:24:08: Launching 'app' on Xiaomi MI 6. App restart successful without requiring a re-install. $ adb shell am start -n "com.tencent.nanodetncnn/com.tencent.nanodetncnn.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Connected to process 17044 on device 'xiaomi-mi_6-f62427a7'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. I/ent.nanodetncn: The ClassLoaderContext is a special shared library. I/Perf: Connecting to perf service. D/ncnn: JNI_OnLoad I/ent.nanodetncn: The ClassLoaderContext is a special shared library. W/Binder:intercep: type=1400 audit(0.0:13634): avc: denied { getattr } for path="/data/data/com.miui.contentcatcher" dev="sda17" ino=1392676 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=dir permissive=0 D/ViewContentFactory: initViewContentFetcherClass getInterceptorPackageInfo W/ent.nanodetncn: Accessing hidden method Landroid/app/AppGlobals;->getInitialApplication()Landroid/app/Application; (light greylist, linking) D/ViewContentFactory: getInitialApplication took 1ms packageInfo.packageName: com.miui.catcherpatch W/Binder:intercep: type=1400 audit(0.0:13635): avc: denied { getattr } for path="/data/data/com.miui.catcherpatch" dev="sda17" ino=1442359 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=dir permissive=0 D/ViewContentFactory: initViewContentFetcherClass took 12ms I/ContentCatcher: ViewContentFetcher : ViewContentFetcher D/ViewContentFactory: createInterceptor took 13ms I/ContentCatcher: Interceptor : Catcher list invalid for [email protected]@26772849 Interceptor : Get featureInfo from config image_pick_mode I/ContentCatcher: Interceptor : Get featureInfo from config pick_mode D/ncnn: loadModel 0x73f4aaa680 D/ncnn: openCamera 0 W/NdkCamera: open W/NdkCamera: open 0 E/ACameraManager: Get camera characteristics from camera service failed: Status(-8): '10: getCameraCharacteristics:496: Unable to retrieve camera characteristics for device : No such file or directory (-2)' openCamera: cannot get camera characteristics for camera . err -10000 E/NdkCameraDevice: ACameraDevice_createCaptureRequest: invalid argument! device 0x0 request 0x73e670d138 E/NdkCaptureRequest: ACaptureRequest_addTarget: Error: invalid input: req 0x0, req-targets 0x0, target 0x73e64c8618 E/NdkCameraDevice: ACameraDevice_createCaptureSession: Error: invalid input: device 0x0, outputs 0x73d81b14c0, callbacks 0x7fea9c2e78, session 0x73e670d150 E/NdkCameraCaptureSession: ACameraCaptureSession_setRepeatingRequest: Error: invalid input: session 0x0, numRequest 1, requests 0x73e670d138 I/Adreno: QUALCOMM build : 2c6a1c7, I1490fecf6e Build Date : 02/04/19 OpenGL ES Shader Compiler Version: EV031.25.03.02 Local Branch : Remote Branch : Remote Branch : Reconstruct Branch : Build Config : S L 6.0.7 AArch64 D/vndksupport: Loading /vendor/lib64/hw/gralloc.msm8998.so from current namespace instead of sphal namespace. I/Adreno: PFP: 0x005ff112, ME: 0x005ff066 I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0 I/OpenGLRenderer: Initialized EGL, version 1.4 D/OpenGLRenderer: Swap behavior 2 D/ncnn: setOutputWindow 0x73d773c010 D/vndksupport: Loading /vendor/lib64/hw/[email protected] from current namespace instead of sphal namespace. D/vndksupport: Loading /vendor/lib64/hw/gralloc.msm8998.so from current namespace instead of sphal namespace. I/ent.nanodetncn: ProcessProfilingInfo new_methods=0 is saved saved_to_disk=0 resolve_classes_delay=8000
I use a XiaoMI6 and the android version is 9.0, I don't konw how to fix this problem.
I also encountered a similar problem. Have you solved this problem?
I got that problem
I got that problem
Can you tell your solution about that? thanks
@nihui Hello please can open the mobile phone flash how to open ah in the opencv