at org.tensorflow.lite.examples.detection.tflite.TFLiteObjectDetectionAPIModel.create(TFLiteObjectDetectionAPIModel.java:126)
at org.tensorflow.lite.examples.detection.DetectorActivity.onPreviewSizeChosen(DetectorActivity.java:103)
at org.tensorflow.lite.examples.detection.CameraActivity.onPreviewFrame(CameraActivity.java:200)
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1220)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6702)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
Caused by: java.lang.IllegalStateException: Internal error: Unexpected failure when preparing tensor allocations: tensorflow/lite/kernels/detection_postprocess.cc:160 NumOutputs(node) != 4 (1 != 4)
Node number 63 (TFLite_Detection_PostProcess) failed to prepare.
at org.tensorflow.lite.NativeInterpreterWrapper.allocateTensors(Native Method)
at org.tensorflow.lite.NativeInterpreterWrapper.init(NativeInterpreterWrapper.java:81)
at org.tensorflow.lite.NativeInterpreterWrapper.<init>(NativeInterpreterWrapper.java:61)
at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:223)
at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:211)
at org.tensorflow.lite.examples.detection.tflite.TFLiteObjectDetectionAPIModel.create(TFLiteObjectDetectionAPIModel.java:124)
... 9 more
在安卓上跑tflite模型报错,有谁知道怎么解决吗?
03/20 19:04:15: Launching 'DetectorActivity' on JJY S10. $ adb shell am start -n "org.tensorflow.lite.examples.detection/org.tensorflow.lite.examples.detection.DetectorActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Connected to process 15069 on device 'jjy-s10-0123456789ABCDEF'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. D/tensorflow: CameraActivity: onCreate org.tensorflow.lite.examples.detection.DetectorActivity@dcd85d4 W/mples.detectio: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection) W/mples.detectio: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection) I/CameraManagerGlobal: Connecting to camera service I/tensorflow: CameraActivity: Camera API lv2?: false D/tensorflow: CameraActivity: onStart org.tensorflow.lite.examples.detection.DetectorActivity@dcd85d4 D/tensorflow: CameraActivity: onResume org.tensorflow.lite.examples.detection.DetectorActivity@dcd85d4 D/ResolutionTunerAppList: loadTunerAppList + E/ResolutionTunerAppList: Target file doesn't exist: system/vendor/etc/sf_resolution_tuner_app_list.xml D/SurfaceExt: SurfaceExtimpl, mPackageName:org.tensorflow.lite.examples.detection,mContainPackageName:false I/SurfaceFactory: [static] sSurfaceFactory = com.mediatek.view.impl.SurfaceFactoryImpl@889c45d D/OpenGLRenderer: Skia GL Pipeline D/ViewRootImpl[DetectorActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@e0949a0, this = DecorView@234959[DetectorActivity] D/Surface: Surface::allocateBuffers(this=0x6f9174f000) 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/Surface: Surface::connect(this=0x6f9174f000,api=1) D/TextureView: getHardwareLayer, createNewSurface:true I/BufferQueue: unnamed-15069-0 BufferQueue core=(15069:org.tensorflow.lite.examples.detection) E/libc: Access denied finding property "vendor.debug.sf.stc_interval" W/mples.detection: type=1400 audit(0.0:12162): avc: denied { read } for name="u:object_r:graphics_debug_prop:s0" dev="tmpfs" ino=11420 scontext=u:r:untrusted_app:s0:c82,c256,c512,c768 tcontext=u:object_r:graphics_debug_prop:s0 tclass=file permissive=0 I/BufferQueueConsumer: unnamed-15069-0 connect(C): consumer=(15069:org.tensorflow.lite.examples.detection) controlledByApp=true E/libc: Access denied finding property "vendor.debug.bq.dump" W/mples.detection: type=1400 audit(0.0:12164): avc: denied { read } for name="u:object_r:debug_bq_dump_prop:s0" dev="tmpfs" ino=11381 scontext=u:r:untrusted_app:s0:c82,c256,c512,c768 tcontext=u:object_r:debug_bq_dump_prop:s0 tclass=file permissive=0 I/BufferQueueConsumer: unnamed-15069-0 setConsumerName: unnamed-15069-0 W/mples.detection: type=1400 audit(0.0:12165): avc: denied { read } for name="u:object_r:graphics_debug_prop:s0" dev="tmpfs" ino=11420 scontext=u:r:untrusted_app:s0:c82,c256,c512,c768 tcontext=u:object_r:graphics_debug_prop:s0 tclass=file permissive=0 E/libc: Access denied finding property "vendor.debug.bq.line" W/mples.detection: type=1400 audit(0.0:12166): avc: denied { read } for name="u:object_r:debug_bq_dump_prop:s0" dev="tmpfs" ino=11381 scontext=u:r:untrusted_app:s0:c82,c256,c512,c768 tcontext=u:object_r:debug_bq_dump_prop:s0 tclass=file permissive=0 E/libc: Access denied finding property "vendor.debug.bq.dump" I/BufferQueueConsumer: SurfaceTexture-0-15069-0 setConsumerName: SurfaceTexture-0-15069-0 E/libc: Access denied finding property "vendor.debug.bq.line" W/mples.detection: type=1400 audit(0.0:12167): avc: denied { read } for name="u:object_r:graphics_debug_prop:s0" dev="tmpfs" ino=11420 scontext=u:r:untrusted_app:s0:c82,c256,c512,c768 tcontext=u:object_r:graphics_debug_prop:s0 tclass=file permissive=0 I/BufferQueueConsumer: SurfaceTexture-0-15069-0 setDefaultBufferSize: width=1200 height=1776 D/OpenGLRenderer: 0x6f917a8d40 setSurfaceTexture: 0x0 to 0x6f83563400 D/Camera-JNI: (tid:15069)[MtkJNICameraContext] this:0x6f93024460 camera->getStrongCount(3) I/tensorflow: CameraConnectionFragment: Desired size: 640x480, min size: 480x480 I/tensorflow: CameraConnectionFragment: Valid preview sizes: [1920x1088, 1920x1080, 1280x720, 720x480, 640x480, 1920x1088, 1920x1080, 1280x720, 720x480, 640x480] I/tensorflow: CameraConnectionFragment: Rejected preview sizes: [352x288, 320x240, 176x144, 352x288, 320x240, 176x144] CameraConnectionFragment: Exact size match found. I/BufferQueueProducer: SurfaceTexture-0-15069-0 connect(P): api=4 producer=(502:???) producerControlledByApp=true E/libc: Access denied finding property "vendor.debug.bq.line" E/ion: ioctl c0044901 failed with code -1: Invalid argument ioctl c0044901 failed with code -1: Invalid argument I/GLConsumer: [SurfaceTexture-0-15069-0] attachToContext I/BufferQueueConsumer: SurfaceTexture-0-15069-0 setDefaultBufferSize: width=1200 height=1600 E/IMGSRV: :0: IsTextureConsistent: IMGEGLImage is not consistent E/IMGSRV: :0: IsTextureConsistent: IMGEGLImage is not consistent I/Camera: handleMessage: 16 W/tensorflow: TFLiteObjectDetectionAPIModel: ??? TFLiteObjectDetectionAPIModel: phone I/tflite: Initialized TensorFlow Lite runtime. E/tensorflow: CameraActivity: Exception! java.lang.RuntimeException: java.lang.IllegalStateException: Internal error: Unexpected failure when preparing tensor allocations: tensorflow/lite/kernels/detection_postprocess.cc:160 NumOutputs(node) != 4 (1 != 4) Node number 63 (TFLite_Detection_PostProcess) failed to prepare.
I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.57 dur=1029.29 max=80.62 min=50.64 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.29 dur=1049.69 max=71.74 min=68.48 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.29 dur=1049.99 max=71.64 min=68.81 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.29 dur=1049.64 max=70.68 min=69.09 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.28 dur=1050.23 max=71.16 min=68.69 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.00 dur=1071.73 max=84.33 min=66.79 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.28 dur=1050.63 max=74.64 min=66.71 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.29 dur=1050.00 max=74.60 min=63.53 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.32 dur=1047.21 max=74.55 min=67.21 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.24 dur=1053.55 max=72.83 min=66.02 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.31 dur=1048.47 max=72.62 min=66.52 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.31 dur=1048.16 max=76.32 min=60.69 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.24 dur=1053.30 max=74.97 min=65.32 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.29 dur=1049.68 max=72.97 min=67.65 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.29 dur=1049.63 max=73.85 min=66.12 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.28 dur=1050.16 max=74.82 min=65.91 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.42 dur=1039.96 max=72.86 min=60.47 I/mples.detectio: Compiler allocated 5MB to compile void android.view.ViewRootImpl.performTraversals() I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.18 dur=1057.60 max=74.79 min=63.80 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.27 dur=1050.94 max=74.90 min=65.13 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.26 dur=1051.83 max=74.06 min=65.56 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.28 dur=1050.17 max=74.63 min=66.11 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.31 dur=1048.03 max=72.01 min=66.53 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.28 dur=1050.33 max=76.53 min=63.06 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.30 dur=1048.92 max=79.93 min=59.59 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.33 dur=1046.87 max=73.44 min=64.26 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.30 dur=1048.63 max=73.85 min=63.60 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.22 dur=1054.93 max=75.18 min=65.83 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.27 dur=1051.06 max=74.58 min=65.79 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.33 dur=1047.03 max=72.17 min=65.48 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.25 dur=1052.93 max=72.58 min=67.15 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.29 dur=1049.80 max=76.07 min=63.18 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.34 dur=1046.19 max=74.61 min=65.24 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.24 dur=1053.31 max=74.79 min=65.21 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.35 dur=1045.12 max=77.58 min=62.18 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.22 dur=1054.71 max=76.76 min=62.93 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.27 dur=1051.44 max=72.58 min=65.74 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.30 dur=1049.12 max=73.11 min=65.26 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.31 dur=1048.23 max=73.49 min=66.12 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.27 dur=1051.21 max=77.13 min=65.94 I/BufferQueueProducer: SurfaceTexture-0-15069-0 queueBuffer: fps=14.29 dur=1049.36 max=73.01 min=65.70