equationl/paddleocr4android

使用v3模型推理时程序崩溃

luomo0101 opened this issue · 8 comments

我使用了官方下载页面中的
ch_PP-OCRv3_rec_slim_infer
加载模型等都正常,识别时看日志det等模型运行也没问题,只是在最后执行推理的时候,就报错并且程序直接崩溃退出,我使用的是最新的
v1.1.1-OpenCL
初始化配置时就只是指定了模型路径,其他并未做什么改动,并且也尝试将isUseOpencl设置成true,但问题一样。
如果使用demo中的v2模型,那是没有问题的,我使用的是小米12,android12,这是崩溃时的日志:
I/OCR_NDK (30583): ocr cpp infer Run start 991008
F/libc (30583): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x55be70b922dec4 in tid 31187 (DefaultDispatch), pid 30583 (com.ocrtest.demo)


Build fingerprint: 'Xiaomi/cupid/cupid:12/SKQ1.211006.001/V13.0.25.0.SLCCNXM:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2022-05-22 20:42:57.253922415+0800
Process uptime: 0s
Cmdline: com.ocrtest.demo
pid: 30583, tid: 31187, name: DefaultDispatch >>> com.ocrtest.demo <<<
uid: 10392
tagged_addr_ctrl: 0000000000000001
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x55be70b922dec4
x0 00000000d2801168 x1 0055be70b922dec4 x2 0000006ed9956700 x3 0055be70b922dec3
x4 0000006eea9a4d48 x5 0000006eea9a4cb8 x6 0000006edfc752e0 x7 0000006edfc75000
x8 0000000000000000 x9 0000000000000001 x10 0000000000004001 x11 0000000000000000
x12 0000000000000000 x13 ffffffffffffffff x14 0000000000000001 x15 0001000000000000
x16 00000071449c8170 x17 00000071676654d0 x18 00000000000000a5 x19 0000006ed9957010
x20 0000006ed9956c50 x21 0000000000000000 x22 0000006ed9957010 x23 0000006ed9957960
x24 0000006ed9957a50 x25 0000006ed9959000 x26 00000000000000ad x27 0000006ed9959000
x28 0000006ed9957cf0 x29 0000006ed9956730
lr 0000006eea70d160 sp 0000006ed9956730 pc 0000006eea70d174 pst 0000000080001000
backtrace:
#00 pc 0000000000489174 /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libpaddle_light_api_shared.so (BuildId: f9edc7993c1c57d2d4608783d535ae69214fc6fe)
#1 pc 000000000048a11c /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libpaddle_light_api_shared.so (BuildId: f9edc7993c1c57d2d4608783d535ae69214fc6fe)
#2 pc 000000000040ed58 /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libpaddle_light_api_shared.so (__cxa_throw+112) (BuildId: f9edc7993c1c57d2d4608783d535ae69214fc6fe)
#3 pc 0000000000318838 /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libpaddle_light_api_shared.so (BuildId: f9edc7993c1c57d2d4608783d535ae69214fc6fe)
#4 pc 0000000000315bfc /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libpaddle_light_api_shared.so (BuildId: f9edc7993c1c57d2d4608783d535ae69214fc6fe)
#5 pc 0000000000374074 /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libpaddle_light_api_shared.so (BuildId: f9edc7993c1c57d2d4608783d535ae69214fc6fe)
#6 pc 00000000003b62c0 /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libpaddle_light_api_shared.so (BuildId: f9edc7993c1c57d2d4608783d535ae69214fc6fe)
#7 pc 00000000003b6204 /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libpaddle_light_api_shared.so (paddle::lite::RuntimeProgram::Run()+52) (BuildId: f9edc7993c1c57d2d4608783d535ae69214fc6fe)
#8 pc 00000000003c3b4c /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libpaddle_light_api_shared.so (BuildId: f9edc7993c1c57d2d4608783d535ae69214fc6fe)
#9 pc 0000000000090d9c /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libNative.so (BuildId: 52d427e8dc2b4e2dde4e0369486bdeb3728a1984)
#10 pc 000000000008e3bc /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libNative.so (BuildId: 52d427e8dc2b4e2dde4e0369486bdeb3728a1984)
#11 pc 000000000008d184 /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libNative.so (BuildId: 52d427e8dc2b4e2dde4e0369486bdeb3728a1984)
#12 pc 000000000007a52c /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/lib/arm64/libNative.so (Java_com_equationl_paddleocr4android_Util_paddle_OCRPredictorNative_forward+156) (BuildId: 52d427e8dc2b4e2dde4e0369486bdeb3728a1984)
#13 pc 0000000000222244 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#14 pc 000000000021329c /apex/com.android.art/lib64/libart.so (nterp_helper+7468) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#15 pc 000000000031a60e [anon:dalvik-classes.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk]
#16 pc 0000000000212bc8 /apex/com.android.art/lib64/libart.so (nterp_helper+5720) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#17 pc 000000000031ade0 [anon:dalvik-classes.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk]
#18 pc 00000000002124c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#19 pc 00000000003194e6 [anon:dalvik-classes.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk]
#20 pc 00000000002124c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#21 pc 000000000031958e [anon:dalvik-classes.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk]
#22 pc 00000000002124c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#23 pc 00000000003192c2 [anon:dalvik-classes.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk]
#24 pc 00000000002124c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#25 pc 000000000011832e [anon:dalvik-classes3.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk!classes3.dex]
#26 pc 0000000000213390 /apex/com.android.art/lib64/libart.so (nterp_helper+7712) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#27 pc 00000000001556fa [anon:dalvik-classes3.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk!classes3.dex]
#28 pc 00000000002124c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#29 pc 00000000001902aa [anon:dalvik-classes3.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk!classes3.dex]
#30 pc 00000000002124c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#31 pc 000000000018f026 [anon:dalvik-classes3.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk!classes3.dex]
#32 pc 00000000002124c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#33 pc 000000000018f154 [anon:dalvik-classes3.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk!classes3.dex]
#34 pc 00000000002124c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#35 pc 000000000018f104 [anon:dalvik-classes3.dex extracted in memory from /data/app/~~PjHS3M3WEerJ2md1d08IoQ==/com.ocrtest.demo-v75QKxqHGKtITD4LhLIUmw==/base.apk!classes3.dex]
#36 pc 0000000000218964 /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#37 pc 0000000000285ff0 /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+192) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#38 pc 000000000062dec0 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValuesart::ArtMethod*(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+464) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#39 pc 000000000067dd9c /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1188) (BuildId: 824f7ca55f9cdc7b2f2fa3478577b69e)
#40 pc 00000000000f0d34 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264) (BuildId: d15a6afaad4d7e44de8683bcf906a6bd)
#41 pc 000000000008d57c /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: d15a6afaad4d7e44de8683bcf906a6bd)

我没记错的话,当前版本不支持 v3 的模型

还有 isUseOpencl 这个设置项我自己测试不能改为 true,否则会报错

这是官方的lite都还不支持v3模型吗?看官方都有v3的md模型,理论上应该是支持的啊。。。
而且加载模型的时候是没问题的,看日志最终也加载成功,只是在开始推理识别的时候就报错了。
另外那isUseOpencl,,一开始没设置,然后报错崩溃了,后面才尝试设置了一下,但问题仍存在。

具体是否支持我也不太确定,翻了一下官方文档,没有发现有相关的说明。

你可以试试用官方的 android_demo 替换 v3 模型能否跑的通,如果跑不通的话就确实是不支持了(仅指当前demo不支持,不表示paddle-lite不支持),因为我这个也是基于上述 demo 改的。

我刚尝试使用了官方的demo,更换v3模型,但是会报如下错误:
Error: This model is not supported, because kernel for 'io_copy' is not supported by Paddle-Lite.
看官方好像并没有说要如何解决这个问题,个人技术有限,不知道该如何解决。
有时间的话您能提供下解决方案吗?或者帮忙测试下官方的demo到底是否可以支持v3模型呢,万分感谢!

这个错误:

Error: This model is not supported, because kernel for 'io_copy' is not supported by Paddle-Lite.

我搜了一下 paddle-lite 的 issue,说是缺少 Opencl ,但是 v1.1.1-OpenCL 这个版本我已经加了 Opencl 依赖。

我没试过这样是否可以运行 v3 模型。

有时间我试试,不过你也可以去 paddle-lite 的 issue 中问问 paddle-lite 2.10 是否支持 ocrV3 的模型,然后把你的报错信息贴上去,看看他们怎么说。

好的,多谢。
另外上面那错误是使用官方demo加载模型的时候报错的,都还没有到真正识别的那一步。
我使用您封装的
v1.1.1-OpenCL
是可以正常,成功加载模型的。
只是在最后执行识别的时候程序崩溃了,崩溃的日志我有发在正文里,不知道是否对您有帮助。

找到了文档,文档中的支持模型中没有 v3 模型,应该是不支持:

支持模型

image